The templates I developed so far, has around 10 module positions included. Well I realized that many users wanted to include some other positions into my templates and customize the layout for their needs. Some users needed this to include their favorite slideshow, instead using the slider included in the template. I decide to create this tutorial and show you how to include a new module position into my Joomla 2.5 and 3.x templates. This tutorial may also work with other frameworks, because it is not limited to my templates only, however you will have to edit other files.
In order to add a new module position to a Joomla template, you will have to edit the index.php file. It is not necessary to know much php programming. You will have to insert and modify the following line of code where you want to add the new position.
<jdoc:include type=”modules” name=”top” style=”none” />
In the above code you will have to edit the name=”top” only, and instead of “top” add the name of the module position you want. The new code will look like this:
<jdoc:include type=”modules” name=”yournewmodule” style=”none” />
This step is not necessary, but it will make your work much easier later on. After editing the index file, now in the same folder, open up the templateDetails.xml with a php or text editor and find the following code:
These represent the module positions, which will show up in the administration panel, when publishing a module. If you want that your new module position to be visible you will have to insert he following code between the <positions></positions> code:
So the new code will look something like this:
<position> yournewmodule </position>
Basically, this is all. Now you can go and check out if you did everything right by publishing a module.
Above I showed you how to add a module positions, but what if you want to find out which are the positions available on the current template and where these are located?
First, in the administrator panel, go to Template Manager and click on the Option button. This will bring you to a page where you can choose to enable the Preview Module Positions option. Save the settings and go to the front-end of your website.
Type the ?tp=1 code after the current URL and hit enter; now you can see the positions that are included in the template, just like in the following image:
There are some cases, when you need to add a module into the Joomla article. To do this, you will have to make sure that the Content – Load Module plugin is activated in the plugin manager:
If the plugin is active, go and edit the article in which you want to add the module. Add the following code somewhere into the content and save the article:
Now go to the module manager, create a new module and publish it to the module position you added earlier into the article: custom_position.
Check the article on the front-end and make sure that the module is rendered as you wanted.
Hope this quick tutorial helped you. If you have any questions please leave a comment bellow.