Load a module within your Joomla! articles

One of the more in-to-depth tricks that Joomla! offers is to load a module within Joomla! content (like an article). This is accomplished by adding the code [loadposition xyz] to your content, and using this new position with your modules. Let's see how far we can stretch the functionality of this little gadget.

Activating the Joomla! plugin Load Module

The basic functionality is that you can add certain tags (code) to your Joomla! articles and use Joomla! Content Plugins to translate these tags to actual code. The [loadposition] tag depends on the Joomla! plugin Content - Load Module (technically called loadmodule).


Browse to the Joomla! Plugin Manager and locate the plugin. You can either use the filter-box on the left to search for its name, or use the selection-box on the right to select all the plugins of type "content". By default the Load Module plugin is enabled.

Inserting the tag within your Joomla! content

Once the plugin is activated, you can add the [loadposition] tag to your Joomla! content. For instance, by adding the following tag to some Joomla! article using the regular Joomla! Article Manager a new module position "content_category_blog" has been created:

[loadposition content_category_blog]

The name "content_category_blog" can be anything. You can set it to "inline_blog" or "user7623". It's best to use a name with only alphanumeric characters and perhaps a dash (-) or underscore (_).


Save the article and preview the article in the frontend. You will actually see that the tag has been stripped from the content. The reason for this is that we have not assigned a module to this new position yet.

Assingning a module to the inline position

Browse to the Joomla! Module Manager and create a new module. In this example we create a new Banners-module, but you can choose any module available. For each module you can define it's position. You can do so by selecting the right position from the dropdown-list. But the dropdown-list can also be edited - it serves as a regular input-field as well.


Enter the name of your position (content_category_blog). If all goes well, once you have enabled a module on this position, you should be able to see the modules output within the Joomla! article at the frontend.

Making it easier to remember the module position

Normally a module position only is used within the Joomla! template, but the Load Module plugin allows for any position in any content. This is very flexible, but you also need to remember which position is placed in which article. To make this easier, you can also add the module position to the dropdown-list of the

To do this, open up the templateDetails.xml file of your Joomla! template, and locate the <positions> section. Add your own position to the list:


Save the file. Once you go back to the Joomla! Module Manager, you will notice that your new position appears in the dropdown-list as well.

Discovering the plugin parameters

If you go back to the Plugin Parameter and open up the Load Module plugin, you will find some parameters on the right. There is a parameter that allows you to enable or disable the plugin, weird because we have such a setting on the left as well. But actually the setting behaves a bit differently:

If we have the Load Module plugin disabled, the [loadposition] tag will not be removed from the content. But if we have the plugin itself enabled, but this setting "Enable Plugin" set to "No", then the [loadposition] tag will be stripped from the content.

Working with chromes

The other parameter allows you to define a style: The dropdown-list mentions divs and tables that can be used to wrap around the modules output. This doesn't do much by itself, but it is very useful when applying CSS-styling to the HTML output.

Those of you familiar with Joomla! templating, will see that this parameter actually equals the option for module chromes (as used with the jdoc-tag):

<jdoc:include type="modules" name="left" style="rounded" />

Adding your own module chrome to the Load Module plugin

Unfortunately, the style-parameter doesn't allow for a custom chrome. But if you want you can hack it in the database. Open up the table "jos_plugins" and locate the row with the element-column set to "loadmodule". Add the following to the "params" field:


Now you can use the new chrome "inline" within your template. By adding a function to the file html/modules.php within your template-directory you can determine the HTML that should surround every module-instance:

function modChrome_inline($module, &$params, &$attribs)
    echo '<div class="module-inline">'.$module->content.'</div>';

The main downside of this approach is that it requires hacking in the database, and as soon as you open up the plugin again and save it, you're custom style is gone.

CSS-styling of the inline module

Still, with the default styles you can do enough things to get you around. When the module-style is set "Wrapped by Divs", a <div class="moduletable"> is added to the modules output. If the main component-area is identified with a specific ID or class (which depends entirely on your template), you can add specific styling for those modules added through the Joomla! Load Module plugin:

table.contentpaneopen div.moduletable {
    float: right;
    border: 1px solid black;
    padding: 5px;

Be careful with caching

One special note when working with the Load Module plugin needs to be made regarding caching. When caching is enabled from with the Global Configuration, the output of every article is cached. This also means that a random banner will not appear random anymore.

Even worse: If you include a form of some kind within the article, for example the login-module, then the form token (which serves as a protection against hackers) will also be cached and there for become invalid. In short: The Load Module plugin may cause problems when caching is enabled in Joomla!.

Using the Load Module plugin with MageBridge

To make things really weird, with MageBridge you can use Joomla! Content Plugins (like the plugin discussed in this tutorial) together with Magento content as well. By adding a [loadposition] tag to a Magento product, you can add a Joomla! module quickly to the product overview besides using the default Magento Markup Tags and Magento 1.4 Widgets.

DemoTags plugin

This tutorial also depends on a little plugin which allows us to write loadposition-tags with brackets [] but display them with curly braces {}. Download the DemoTags plugin here.