Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Security arrow #10 - Load module positions mambot

Print E-mail

#10 - Load module positions mambot

Did you know it is possible to actually load a module directly in your content? E.g. We want to load our Featured Articles module in an article rather than in a module position. We can do this using the Load Module Position default Joomla mambot.

 

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.  

Comments
Add NewSearchRSS
Ryan - Load module positions mambot IP:71.8.211.173 | 2007-07-14 16:37:04
Ive used this technique to load in my news content using the mod_latestnews module. When I do the news module loads perfectly. But for some reason, the content item that I put the call in also shows up as a news item. I dont want this to be a news item. How would i overcome this?
DART Creations - Load module positions mambot IP:85.232.196.46 | 2007-07-14 23:26:04
The latest news items by default shows: "a list of the most recently published Items that are still current". Therefore since the last thing you do when you do the above technique is to save the current content item, this is causing the current content item to be the most recently published item, and thus included in the news.

To overcome it, guess you would need to publish more changes, such that the current item bubbles down the Latest News module. The best option would be to start with the item that contains the Latest news, and then enter the other items after it such that they are more recent.
Tumbleweed - Load module positions mambot - IP:75.92.242.157 | 2008-02-06 08:59:10
This function has changed in Joomla 1.5 and is now a default plugin with your Joomla install. You can call any module position in a content item with the following code:

{loadposition user4}

Remember, you have to enable the loadmodule plugin from the Plugin Manager.

That is all,
Tumbleweed
koamang - Bali Web Design IP:125.162.135.6 | 2008-02-07 09:42:38
very usefull
great tutorial

thanks anyway
http://www.balipublisher.com
Arthur - dcode communications IP:72.252.152.16 | 2008-06-13 13:09:40
thank you. i could not remember this for the life of me
Write comment
Name:
Title:
Security Image
 

Subscribe to our feed


RSS Feed

DART Creations - Joomla Tutorials, Tips and Tricks and more...

Joomla Tips

DART Creations Joomla Tips, Tricks, tutorials and general Joomla help

Sponsors

Login Form






Lost Password?
No account yet? Register