add module automatically on position without select position Topic is solved
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Intern
- Posts: 97
- Joined: Sat Dec 24, 2016 9:26 am
add module automatically on position without select position
hi
i want to add module in a position without select any positions .
this mean :
click to add the module , setup settings and click save without chose position, then the module show on the page .
is it possible to do it ?
thanks
i want to add module in a position without select any positions .
this mean :
click to add the module , setup settings and click save without chose position, then the module show on the page .
is it possible to do it ?
thanks
Last edited by imanickam on Sun May 28, 2023 3:23 am, edited 1 time in total.
Reason: Moved topic » from Joomla! 4.x Coding to General Questions/New to Joomla! 4.x
Reason: Moved topic » from Joomla! 4.x Coding to General Questions/New to Joomla! 4.x
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: add module automatically on position without select position
Although the documentation for adding a new module in J! 4.x is not as comprehensive as documentation written for previous versions of J!, a module will not appear on a website unless it has been assigned to a position on the template. That is how J! has always worked.
So, to answer your question,
So, to answer your question,
The answer is no.
- Webdongle
- Joomla! Master
- Posts: 42902
- Joined: Sat Apr 05, 2008 9:58 pm
Re: add module automatically on position without select position
In theory a module installation script could search the database for the Default Template. Then search for the Positions for the Template. But in practice randomly assigning the module to a vacant position would end in CHAOS
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Intern
- Posts: 97
- Joined: Sat Dec 24, 2016 9:26 am
Re: add module automatically on position without select position
i dont mean to add the module without position .
i mean , how to add the module in this position automatically .
or
how to make the position selected by default when open the module admin form ?
i mean , how to add the module in this position automatically .
or
how to make the position selected by default when open the module admin form ?
- AMurray
- Joomla! Exemplar
- Posts: 9119
- Joined: Sat Feb 13, 2010 7:35 am
- Location: Australia
Re: add module automatically on position without select position
Seems a very impractical idea to have one specific position as default. Joomla is not going to know where you want to place the module until you tell it what position you want it in.
Regards - A Murray
- Per Yngve Berg
- Joomla! Master
- Posts: 30306
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: add module automatically on position without select position
Perhaps you should tell us the reason for this strange request. Then we may have a solution for you.
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: add module automatically on position without select position
The question is "How can you automatically select a module position by default when creating a new module in Joomla?". It's a simple question. We don't need to know the reason why. The reason is obvious: people forget to assign an module position or they're too lazy to perform one mouse-click before pressing the Save button.
Here's the solution: write a plugin to populate the position text box.
I'm not going to write this plugin (to save one mouse-click) for someone else without some added incentive.
A better—and the cheapest—solution is to remember to perform one extra mouse-click (to select the module position) before you press the Save button.
Here's the solution: write a plugin to populate the position text box.
I'm not going to write this plugin (to save one mouse-click) for someone else without some added incentive.

A better—and the cheapest—solution is to remember to perform one extra mouse-click (to select the module position) before you press the Save button.
- Per Yngve Berg
- Joomla! Master
- Posts: 30306
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: add module automatically on position without select position
Simplest solution: Override the form in the Administrator template and add a Default Value to the Input Element.
- Webdongle
- Joomla! Master
- Posts: 42902
- Joined: Sat Apr 05, 2008 9:58 pm
Re: add module automatically on position without select position
Yes we do because the OP often think they know how to solve their problem but don't. Hence they ask the wrong question. If they tell us what they are trying to achieve then we ca often work out how they can achieve it.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Intern
- Posts: 97
- Joined: Sat Dec 24, 2016 9:26 am
Re: add module automatically on position without select position
here is my idea :
i added this code in a file in my videos component :
this code added a custom position in my component .
the word "playlist_module" is not included in positions select menu . i must to write it all the time and cant find it when search it . so i want to add the module in easy way , because i forget this name and need to open the php file to coppy it . also i will add this module very much times on this position .
i added this code in a file in my videos component :
Code: Select all
<?php echo JHtml::_('content.prepare', '{loadposition playlist_module}'); ?>
the word "playlist_module" is not included in positions select menu . i must to write it all the time and cant find it when search it . so i want to add the module in easy way , because i forget this name and need to open the php file to coppy it . also i will add this module very much times on this position .
can you tell me more about this form ? where is it , what is its name ? please .Per Yngve Berg wrote: ↑Sun May 28, 2023 8:19 amSimplest solution: Override the form in the Administrator template and add a Default Value to the Input Element.
- Per Yngve Berg
- Joomla! Master
- Posts: 30306
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: add module automatically on position without select position
It's Module Manager in the Administrator.
Can you use this: https://extensions.joomla.org/extension/allvideos/
It's a Plugin instead of a module.
Can you use this: https://extensions.joomla.org/extension/allvideos/
It's a Plugin instead of a module.
-
- Joomla! Intern
- Posts: 97
- Joined: Sat Dec 24, 2016 9:26 am
Re: add module automatically on position without select position
no i will not use it , because i have a full video component works like [youtube] site .Per Yngve Berg wrote: ↑Sun May 28, 2023 7:54 pmIt's Module Manager in the Administrator.
Can you use this: https://extensions.joomla.org/extension/allvideos/
It's a Plugin instead of a module.
i dont use articles on my site .
thanks
- Webdongle
- Joomla! Master
- Posts: 42902
- Joined: Sat Apr 05, 2008 9:58 pm
Re: add module automatically on position without select position
That's because that code does not add a position to the list. The position needs to be declared in the Template's templateDetails.xml file for it to be listed. https://docs.joomla.org/Declaring_module_positionssofian10 wrote: ↑Sun May 28, 2023 7:20 pmhere is my idea :
i added this code in a file in my videos component :this code added a custom position in my component .Code: Select all
<?php echo JHtml::_('content.prepare', '{loadposition playlist_module}'); ?>
the word "playlist_module" is not included in positions select menu . ...
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: add module automatically on position without select position
OK ... so now that we understand why the OP wants this, is it possible to set things up so that any (or a specific) newly-added module uses the position playlist_module as the default (without having to key-in the value)? Yes or no and, if yes, how?
- Per Yngve Berg
- Joomla! Master
- Posts: 30306
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: add module automatically on position without select position
You will have a better solution using a Plugin rather than a Module.
https://docs.joomla.org/Supporting_plug ... _component
https://docs.joomla.org/Supporting_plug ... _component
- Pavel-ww
- Joomla! Ace
- Posts: 1339
- Joined: Tue Jun 30, 2020 12:17 pm
Re: add module automatically on position without select position
Hi. You can add position to templateDetails.xml, following @Webdongle's advice. But this is optional. If at least one module was published in position just by writing its name, then you can find it in active positions.sofian10 wrote: ↑Sun May 28, 2023 7:20 pmthe word "playlist_module" is not included in positions select menu . i must to write it all the time and cant find it when search it . so i want to add the module in easy way , because i forget this name and need to open the php file to coppy it . also i will add this module very much times on this position .
And if you will add a module to this position many times, you will definitely not forget its name

I think you will come to the fact that the solution to this problem in the way that you want to solve it does not make sense. Personally, I very often use my own positions and have never experienced discomfort. Joomla basic capabilities are enough to manage all these things.
You do not have the required permissions to view the files attached to this post.
- AMurray
- Joomla! Exemplar
- Posts: 9119
- Joined: Sat Feb 13, 2010 7:35 am
- Location: Australia
Re: add module automatically on position without select position
Normally you would use plugins within articles such as a "quick tag" type that might for instance embed a video player instead of having to use the actual HTML <embed> or <iframe> which are typically used to embed third party content (such as YT videos and the like).
Regards - A Murray
-
- Joomla! Intern
- Posts: 97
- Joined: Sat Dec 24, 2016 9:26 am
Re: add module automatically on position without select position
I thank you all for your cooperation and assistance.
I decided to use "Save as a copy", and here the settings will remain constant and repeated with the same options.
Once again thanks
I decided to use "Save as a copy", and here the settings will remain constant and repeated with the same options.
Once again thanks