Saturday, April 17, 2010

Load any module within a joomla 1.5 content article

One of the questions that often gets asked is "How can I load a Joomla! 1.5 Module into a content Article? This is in fact an easy thing to do, and can provide useful solutions such as:

  • Loading in a Paypal Module into an Article.
  • Displaying Advertising within your Content.
  • Including Adsense Modules within your Content Articles.
  • Displaying Audio and Video within Articles.

By default, Joomla! Modules can be placed in any Module Position of the Template, but they do not load into Content Articles.

This tutorial will explain how to enable and use Module loading within your Joomla! Articles, Here are the steps:

Step 1 - Create a new Module or Copy an existing one.

Within your Joomla! Administration, navigate to Extensions > Module Manager.

If you are creating a new Module, click on the New button at the top right of the screen, or you can put a tick in the box next to an existing Module and copy it using the Copy button.

Module in Article Toolbar

If you copy an existing Module, the new Module will be created or copied and placed within the Module listing.

Step 2 - Edit the Module

Module in Article Module ParametersIf you have created a new Module you will be ready to roll, but if you copied an existing Module click on the title of it to load the Module Edit Screen.

On the left side of the Module Edit Screen you will see some properties such as Module Title, Enabled, Module Position etc. Here is where the power of Joomla! shows itself. Usually we would just click on the Module Position field and select an available Module Position, but it is also possible to enter in your own value here as believe it or not, this field is editable!

We need to edit this field and enter in a custom Module Position Name which will be used for our in-content use. Instead of clicking on the Arrow next to this field, click on the text within the field, and enter in your own value such as, content_custommod

Module in Article - Module Field

If you need to make other changes to your Module parameters then do so and when you are finished, make sure you click the "SAVE" button at the top right of the screen. Your new custom module position will then be saved with this Module.

Step 3 - Check the Plugin

Module Article Plugin ParametersWithin the Administration, navigate to the Extensions > Plugin Manager. Search for a plugin named Content - Load Module, it may already be published but click on the Title of the Plugin to Edit. Once you are in the Plugin Edit Screen, on the right side you will see a list of available Plugin Parameters. Make sure that the option No Wrapping - raw output has been selected, and click Save on the Plugin.

Step 4 - Load Module in Article

Navigate to the Article Manager Screen, and Edit the Article you wish to load the Module within. Click on it's title to load the Article Edit Screen.

Within the desired location of the Article, enter the following syntax in, which is code to tell the Module to load.

Module in Article - Article Tagloadposition is a constant which activates the plugin. modulename is the custom position that we entered into our module field earlier. In our example we used: content_custommod, so the whole tag would look like: . Your Module has now been told to load into your custom Position, and with the help of the included Joomla! Plugin we have told our Article to show the Module in that position within our page. Refresh the front-end of your Joomla! website to see the module.

IMPORTANT NOTE: Do not enter in a common Template Module Position such as "Top" or "Left" into your loadposition tag. This may display all of the modules that are then set to show in that Position.

No comments: