How to put modules in Joomla articles
- Written by Forest Linden Forest Linden
- Category: Joomla Tutorials Joomla Tutorials
- Published: 16 February 2010 16 February 2010
One of the handiest tools you can have in your Joomla toolbox is the ability to put the contents of a module right into the body of an article. (The article you're reading now is using this method. See the message in the box right above this sentence? That's actually content from a module being loaded right into this article.)
This can be a significant timesaver, since you can create a module one time in the Module Manager and then simply place it into any number of articles on your site.
That means you wouldn't have to set up that content individually in every article: you do the work once and then simply tell Joomla where you want that module to appear.
To show you how to do this, I'll show you an example of using this method to put a newsletter sign up form right in an article.
Here's a look at the end result:
Here's how to do this:
1) In Joomla go to Extensions>Module Manager. Then click on New to create a new module.
2) Select Custom HTML from the list of available modules. (You can put other types of modules in articles, but for this example I'll show you how to do this with a custom HTML module.)
3) Name your module. In this example, I named the module "Newsletter sign up."
4) Set show title to "No."
5) For the module Position (and here's the key of this trick), put your cursor in the field next to "Position" and type in a new position name. In this example, I've called the new position "newsletter."
6) For the menu assignment, you can leave it set to All.
7) In the Custom Output area, enter in whatever content you want to have in this module. In this example, I've got some code entered that's creating the iContact newsletter sign up form:
8) When you're done, save the module.
9) Go into the Article Manager (Components>Article Manager) and open up an article where you'd like to put this module.
10) Wherever you want the module to be, type in this syntax (which is sometimes referred to as the "loadposition syntax") :
Replace "newmoduleposition" with the name of the new module position you created when you typed in the new position name in the custom HTML module.
For my example, this is how my article with the newsletter module in it looks when opened up in Joomla:
11) Save the article and check how it looks on the front of your site. That's it!
Now, whatever article on your site that you want to have this module appear in, all you have to do is enter in the loadposition syntax and it will appear.