Join Us!

Actionable tips for people who work with websites

Is your website critical? We'll give you awesome tips you can action today.

 

Webdesign

Joomla Plugins

Joomla loadmodule: put a joomla module in an article

Did you know it is possible to put a module in an article in Joomla i.e. directly in your content using the Joomla loadmodule function? E.g. We want to put our Joomla Paypal module in an article rather than in a module position. We can do this using the LoadModule position default Joomla plugin. There are of course many other reasons to place a module in an article. Another very good example for putting a module in an article is when we add a CTA (Call-to-action) for somebody to join our mailing list. 

 

Joomla loadmodule for 2.5 and 3

First of all make sure you have created and defined the module which you want to show in the article. This is fairly simple to do

  1. In the top menu go to Extensions and click Module Manager
  2. Use the filter feature to search for and find the module you want to put in an article and click the module. You can also create a new one, or create a copy of one which exists.
  3. Create a new position name by typing a new name (one that won't conflict with any positions used by your template). For example, let's type in_article_subscribe
  4. Under Module Assignment, select the pages you want to assign the module to and Save. We typically apply it all pages so that we can use it anywhere we want to across the site.

Now, once you have created the module you want to display in the article, there is a default plugin which now can load the module or module position in the article. You can call any module position in a content item with the following code

Use Joomla loadmodule to put a module in an article 

{ loadposition in_article_subscribe }

NB: (REMOVE the leading and trailing spaces before the {})

You can also specifically load a single module

{ loadmodule mod_login } 

NB: (REMOVE the leading and trailing spaces before the {})

Remember, you have to enable the "Content - Load Modules" plugin from the Plugin Manager.

Another good example which we like to use, is to load the Login module for those users who have not logged in yet, or show them a message that they should register and login. This is an excellent opportunity to use the Joomla load module function to insert a Joomla module in article.

Joomla Loadmodule - put a module into an article

NB: Remove ALL spaces between . There should be NO leading or trailing spaces. We could not do this above because otherwise, Joomla (our CMS) would have removed the text and tried to replace it ;-) Also make sure it's all in lowercase. To make it simpler it should like this .

Another good example of usage of this module is this. You want to create an advert (or affiliate link), but instead of copying and pasting the code, you want to be able to replicate this advert at will in your content items. Therefore you use the mod_html module to create the advert you need. Now, each time you want to display this advert, you just insert the { mosloadposition xxxx } (be sure to remove extra spaces before mosloadpostion and after xxxx, spaces were added intentionally in this example)  in the content. The good thing about this is that if you want to change the advert, you only need to change this in the module rather than in every content item. Below we are using the functionality to show our subscribe box! 

Join our list of 21,000+ subscribers and get awesome content!

Joomla 1.0

Edit: See bottom for a new way of doing this, using a 3rd party module though

The Load Module positions mambot allows us to load any mambot position as a mambot. Therefore to load the module in a content article we can use the following workaround.

  • From the Template Positions (Site > Template Manager > User Positions), choose a module position which is not used in your template e.g. user8. If all your positions are used in the template, create a new position.

Create a new template position

  • Assign the module you want to display to the position you have chosen above - Modules > Site Modules. Make sure that Menu Item links is set to All (otherwise the position will not load)

Setup the module with all necessary parameters

  • In your content item enter the following: { mosloadposition user8 } (be sure to remove extra spaces before mosloadposition and after user8, spaces were added intentionally in this example). This will be replaced by the content of the module(s) assigned to that position.

Insert the mambot text into your content

Below is an example of usage of this module. We are loading the Featured Articles Module in the content of this article:

Another good example of usage of this module is this. You want to create an advert (or affiliate link), but instead of copying and pasting the code, you want to be able to replicate this advert at will in your content items. Therefore you use the mod_html module to create the advert you need. Now, each time you want to display this advert, you just insert the { mosloadposition xxxx } (be sure to remove extra spaces before mosloadpostion and after xxxx, spaces were added intentionally in this example)  in the content. The good thing about this is that if you want to change the advert, you only need to change this in the module rather than in every content item.

Edit: There is a cool module which allows you to avoid all the hassle above. Amongst various functions it allows you to use code as follows to do the above in a much simpler manner:

{mosmodule modulename} and the module is immediately loaded.  Of course the Joomla loadmodule function now makes all of this obsolete.

Want to supercharge your website?

  Our website loads FAST ... just 1.29 seconds. We're hosted on FAST InMotion servers We want YOUR website to be fast too, so we've gotten you an exclusive deal - 47% OFF for DART Creations friends + FREE domain! Check it out NOW!

Translate

Follow us on Social

     

 

Where are we hosted?

This site is proudly powered by FAST VPS InMotion Servers and given an insane speed thanks to MaxCDN!

Web Hosting MaxCDN - Speed up your website

 

InMotion Hosting Review - Recommended Web Hosting servers for business, Joomla, WordPress and ecommerce websites.

inmotion Hosting Review

Advertise on DART-Creations.com

DART Creations is interested in developing partnerships with mutual benefit. If you like the stuff we publish and would like to develop a relationship, we'd be happy to hear from you. Go on - drop us a line - we'd love to hear from you :-)

The SUMMER DESIGN Bundle

27 premiums fonts, 91 graphic packs for  $29. Get it NOW - May Only!

summer design bundle

New! DIVI 2.7 WordPress TeMPLATE + PageBuilder

You'll surely create a perfect website with Divi 2.7!

Divi WordPress Theme