The Joomla Load Module Plugin

29,533 views
33,950 views

Published on

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.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
29,533
On SlideShare
0
From Embeds
0
Number of Embeds
15,880
Actions
Shares
0
Downloads
44
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

The Joomla Load Module Plugin

  1. 1. The Joomla LoadModule PluginThis tutorial covers the Joomla Load Module plugin. It explains how to use the{loadposition} and {loadmodule} tags, and their variations, to embed modulesdirectly in your site content (for example, in an article). It is applicable forJoomla 1.5, Joomla 2.5 and Joomla 3. © 2005-2013 New Life in IT Pty Ltd - Visit learn.theartofjoomla.com to learn more about Joomla!
  2. 2. Configuring the Load Module Plugin
  3. 3. The easiest way to find the Load Module plugin isto go to the Plugin Manager in the Joomlaadministrator (it’s under “Extensions” in the topmenu) and change the “Select Type” filter to“content”.TipIf you don’t actually need to embed modules ormodule positions in your content, it is a good ideato disable this plugin. Disabling any contentplugin that you don’t really need will give you asmall performance boost.Also note that in Joomla 2.5 and Joomla 3, whenSmart Search is used (Finder), content plugins areturned off to index the content.
  4. 4. Load Module Plugin OptionsThe Load Module plugin has the option to set thestyle by which the module will display. Theoptions correspond to the following modulesstyles in the template:Wrapped by table (column) - tableWrapped by table (horizontal) - horizWrapped by Divs - xhtmlWrapped by Multiple Divs - roundedNo wrapping - none“Wrapped by Divs” or “No wrapping” would bethe most common selections.Note that in Joomla 1.5, there is an additionaloption called “Enable Plugin”. If the Load Moduleplugin was enabled, but this option was set to“No”, then any matching plugin tags, like{loadposition}, would be stripped from thecontent. Note also that the {loadmodule} tag isnot available in Joomla 1.5.In Joomla 2.5 and Joomla 3, this option does notexist. If the Load Module plugin is disabled, anyusage of {loadposition} or {loadmodule} in thebody content will appear unchanged on the site.
  5. 5. Using {loadposition} in Content
  6. 6. Option 1 - Loading a Module PositionThe Load Module plugin allows you to enter:{loadposition module_position}within your content. This will embed all themodules configured to display in“module_position” according to the rules that youset in the administrator’s Module Manager.In the example, the tag will embed any modulesassigned to the “saythanks” module position inthe content. The module style will be what you setin the options of the Load Module position.Most editors will place the plugin call withinparagraph tags.This may suit your needs but if it doesn’t, changeyour editor to view the source and change theenclosing paragraph tags to div tags.You may also want to add a class to the div foradditional styling. A ‘clearfix’ div may also bedesirable depending on how you configure ordisplay the modules in the selected position.
  7. 7. Option 2 - Loading a Position with a StyleIn Joomla 2.5 and Joomla 3, you can alsooverride the module style by entering:{loadposition module_position,style}where the style is added after the moduleposition, separated by a comma.LimitationsWhen using more than one {loadposition} tagwithin the same content for the same position, themodule style will be fixed after the first use. This isbecause the Load Module plugin caches themodules in a given position.However, this would be a very rare case (probablyonly used by people trying to write tutorials abouthow to use the Load Module position).
  8. 8. Next, you need to add the module you want todisplay. Here I’m adding a simple Custom HTMLmodule to display a link to my Amazon wish list.The position needs to be set to whatever wasused in the {loadposition} call in the content. Youmay or may not want to show the title of themodule (particularly when using the “xhtml” style).The text of the module can be filled out as desiredand the module assignment needs to beconfigured (“On all pages” is the easiest).
  9. 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 thatwas set in the plugin is used (and in this case, thatwas “No wrapping” or “raw” in template speak).Notice with this style, the module title will neverbe displayed.The bottom image shows how {loadposition} canoverride the style set in the plugin. In this case,the “xhtml” style is set. You can see this becausethe title is showing. You can, of course, toggle thetitle from the Module Manager using thisparticular module style.
  10. 10. Using {loadmodule} in Content
  11. 11. Option 1 - Loading a Default ModuleIn Joomla 2.5 and Joomla 3, a second tag,{loadmodule}, was added to the Load Moduleplugin. As its name suggests, instead of loading aposition containing any number of modules, it justloads a single instance of a module.The tag is written in the form of:{loadmodule module}where “module” is the name of the folder themodule resides in. The example shows how toinclude a plain Login module in your content.
  12. 12. The {loadmodule mod_login} tag is replaced witha plain Login module.LimitationsBecause you are just setting the module type,there is no information associated with themodule. No title will be available for the moduleand any options that the module requires will usethe default values set in the module code itself.Unless the module is extremely simple, it is oftenbetter to specify a module that you haveconfigured in the Module Manager. See the nextslide for how to do that.
  13. 13. Option 2 - Loading a Module by TitleYou can also load a specific module from themodule by supplying its title after the module typein the form:{loadmodule module,title}where “title” is the title you gave the module in theModule Manager.CautionThe module type and the title must match exactly.If you have more than one module of the sametype with the same name, the results could beunpredictable (Joomla will probably display thefirst one it finds by the order it was added to thedatabase).
  14. 14. The tag has been replaced with the instance ofthe “Amazon Wishlist” module that I created inthe Module Manager.Note that the module style is whatever was set asthe default in the Load Module plugin (in this case“No Wrapping” or “raw”).LimitationsYou can only use one type of module on the samepage, regardless of where the content is. As for“loadposition”, the module is cached against itstype, not its title.
  15. 15. Option 3 - Loading a Module by TitleFinally, you can also a specific module from theModule Manager with a specific style bysupplying the style after the module type and titlein the form:{loadmodule module,title,style}where “style” is the desired module style.
  16. 16. The tag has been replaced with the instance ofthe “Amazon Wishlist” module and displayed inthe “xhtml” style so that that title will display.
  17. 17. Core ModulesTypesIn Joomla 1.5, the type of module would bedisplayed in the “Type” column in theModule Manager or in the “Module” columnof the Extension Manager.Unfortunately, for our purposes, Joomla 2.5and Joomla 3 translate the module typeinto readable text. The next slide lists thecore modules in Joomla 2.5 and Joomla 3.
  18. 18. Frontend Modules Types in Joomla 2.5 and3mod_articles_archive mod_languagesmod_articles_categories mod_loginmod_articles_category mod_menumod_articles_latest mod_random_imagemod_articles_news mod_related_itemsmod_articles_popular mod_searchmod_banners mod_statsmod_breadcrumbs mod_syndicatemod_custom mod_users_latestmod_feed mod_weblinksmod_finder mod_whosonlinemod_footer mod_wrapper
  19. 19. And if you really did like this tutorial Here is my Amazon wish list
  20. 20. it’s not the end it’s just the beginning ...learn.theartofjoomla.com

×