You will usually want to associate modules with articles in some way. The modules are allocated to module positions and the module positions appear somewhere on the Web page as determined by the template. However, it is sometimes useful to have a module actually embedded within the article. Joomla core provides three ways to do that: loadposition, loadmodule and loadmoduleid. The plugin "Content - Load Modules" must be enabled.
Syntax:
To insert a module inside an article, you publish the module to a position and load that position in the article as follows:
An alternative to "{loadposition xx}" is the "{loadmodule yyy}" variation which is handled by the same plugin.
In this case the plugin looks for the first module who's type matches the string 'yyy'. So you could load a "mod_login" module by placing {loadmodule login} in your text. If you wish to load a specific instance of a module, because you have more than one login module e.g. titled as Login 1, Login 2, etc. you have to use {loadmodule mod_modType, modTitle} where mod_modType would be mod_login and modTitle is name/title given to your instance of that module. So in the example above you end up with {loadmodule mod_login Login 2}. You can also add the style that is used for rendering the module. To do so, add the style as the third parameter like {loadmodule login,login2,xhtml}. If you don't add a style, then "none" is used.
Since Joomla! version 3.9.0 an alternative to {loadposition xx}
and {loadmodule yyy}
is the variation {loadmoduleid z}
which is handled by the same plugin.
In this case the plugin looks for the module who's id
matches the number z
. So you could load the module with id 200 by placing {loadmoduleid 200}
in your text. This variant does not "understand" additional parameters like the style
parameter.
If the editor-xtd plugin "Button - Module" is activated you can use the editor button "Module" to insert above described tags more easily into the editor text. Since Joomla! 3.9 also the loadmouleid
variant.
It is possible in Joomla! 2.5+ and Joomla! 3.x+ to include a module within a "Custom HTML" module. They are processed by content plugins in the same way as articles.
To make this work, the option Prepare content must be enabled as shown in this screenshot.
You should remember when doing this that you might experience formatting issues as the "chrome" of the "Custom HTML" module will surround the "chrome" of the included module potential having undesirable effects of the formatting or layout. That's the reason why the "Module" editor button is not available in modules of type "Custom".