This tutorial covers the Joomla Load Module plugin. It explains how to use the {loadposition} and {loadmodule} tags, and their variations, to embed modules directly in your site content (for example, in an article). It is applicable for Joomla 1.5, Joomla 2.5 and Joomla 3.
3. The easiest way to find the Load Module plugin is
to go to the Plugin Manager in the Joomla
administrator (it’s under “Extensions” in the top
menu) and change the “Select Type” filter to
“content”.
Tip
If you don’t actually need to embed modules or
module positions in your content, it is a good idea
to disable this plugin. Disabling any content
plugin that you don’t really need will give you a
small performance boost.
Also note that in Joomla 2.5 and Joomla 3, when
Smart Search is used (Finder), content plugins are
turned off to index the content.
4. Load Module Plugin Options
The Load Module plugin has the option to set the
style by which the module will display. The
options correspond to the following modules
styles in the template:
Wrapped by table (column) - table
Wrapped by table (horizontal) - horiz
Wrapped by Divs - xhtml
Wrapped by Multiple Divs - rounded
No wrapping - none
“Wrapped by Divs” or “No wrapping” would be
the most common selections.
Note that in Joomla 1.5, there is an additional
option called “Enable Plugin”. If the Load Module
plugin was enabled, but this option was set to
“No”, then any matching plugin tags, like
{loadposition}, would be stripped from the
content. Note also that the {loadmodule} tag is
not available in Joomla 1.5.
In Joomla 2.5 and Joomla 3, this option does not
exist. If the Load Module plugin is disabled, any
usage of {loadposition} or {loadmodule} in the
body content will appear unchanged on the site.
6. Option 1 - Loading a Module Position
The Load Module plugin allows you to enter:
{loadposition module_position}
within your content. This will embed all the
modules configured to display in
“module_position” according to the rules that you
set in the administrator’s Module Manager.
In the example, the tag will embed any modules
assigned to the “saythanks” module position in
the content. The module style will be what you set
in the options of the Load Module position.
Most editors will place the plugin call within
paragraph tags.
This may suit your needs but if it doesn’t, change
your editor to view the source and change the
enclosing paragraph tags to div tags.
You may also want to add a class to the div for
additional styling. A ‘clearfix’ div may also be
desirable depending on how you configure or
display the modules in the selected position.
7. Option 2 - Loading a Position with a Style
In Joomla 2.5 and Joomla 3, you can also
override the module style by entering:
{loadposition module_position,style}
where the style is added after the module
position, separated by a comma.
Limitations
When using more than one {loadposition} tag
within the same content for the same position, the
module style will be fixed after the first use. This is
because the Load Module plugin caches the
modules in a given position.
However, this would be a very rare case (probably
only used by people trying to write tutorials about
how to use the Load Module position).
8. Next, you need to add the module you want to
display. Here I’m adding a simple Custom HTML
module to display a link to my Amazon wish list.
The position needs to be set to whatever was
used in the {loadposition} call in the content. You
may or may not want to show the title of the
module (particularly when using the “xhtml” style).
The text of the module can be filled out as desired
and the module assignment needs to be
configured (“On all pages” is the easiest).
9. The images to the left show the final product.
The top image shows the standard usage of
{loadposition}. In this case, the module style that
was set in the plugin is used (and in this case, that
was “No wrapping” or “raw” in template speak).
Notice with this style, the module title will never
be displayed.
The bottom image shows how {loadposition} can
override the style set in the plugin. In this case,
the “xhtml” style is set. You can see this because
the title is showing. You can, of course, toggle the
title from the Module Manager using this
particular module style.
11. Option 1 - Loading a Default Module
In Joomla 2.5 and Joomla 3, a second tag,
{loadmodule}, was added to the Load Module
plugin. As its name suggests, instead of loading a
position containing any number of modules, it just
loads a single instance of a module.
The tag is written in the form of:
{loadmodule module}
where “module” is the name of the folder the
module resides in. The example shows how to
include a plain Login module in your content.
12. The {loadmodule mod_login} tag is replaced with
a plain Login module.
Limitations
Because you are just setting the module type,
there is no information associated with the
module. No title will be available for the module
and any options that the module requires will use
the default values set in the module code itself.
Unless the module is extremely simple, it is often
better to specify a module that you have
configured in the Module Manager. See the next
slide for how to do that.
13. Option 2 - Loading a Module by Title
You can also load a specific module from the
module by supplying its title after the module type
in the form:
{loadmodule module,title}
where “title” is the title you gave the module in the
Module Manager.
Caution
The module type and the title must match exactly.
If you have more than one module of the same
type with the same name, the results could be
unpredictable (Joomla will probably display the
first one it finds by the order it was added to the
database).
14. The tag has been replaced with the instance of
the “Amazon Wishlist” module that I created in
the Module Manager.
Note that the module style is whatever was set as
the default in the Load Module plugin (in this case
“No Wrapping” or “raw”).
Limitations
You can only use one type of module on the same
page, regardless of where the content is. As for
“loadposition”, the module is cached against its
type, not its title.
15. Option 3 - Loading a Module by Title
Finally, you can also a specific module from the
Module Manager with a specific style by
supplying the style after the module type and title
in the form:
{loadmodule module,title,style}
where “style” is the desired module style.
16. The tag has been replaced with the instance of
the “Amazon Wishlist” module and displayed in
the “xhtml” style so that that title will display.
17. Core Modules
Types
In Joomla 1.5, the type of module would be
displayed in the “Type” column in the
Module Manager or in the “Module” column
of the Extension Manager.
Unfortunately, for our purposes, Joomla 2.5
and Joomla 3 translate the module type
into readable text. The next slide lists the
core modules in Joomla 2.5 and Joomla 3.