After creating or installing new module in joomla,you may struck how to create a position for the new module and for existing module. Let us see how to add a new module position in an existing joomla template.
Now, let us see step by step process setting position
Step 1: Getting Started
For Joomla 1.6,1.7,2.5:
Go to admin→template manager→select template
Template master files are listed here. Then click “Edit main page template”. The index.php file of the selected template will open.
For Joomla 1.5:
Open the file “<your Joomla! home>/templates/template_name/index.php” for editing and determine where your new position will be on the page.
Step 2: Adding Position to index.php
Insert the following code where you want to place new module.
Syntax: <jdoc:include type=”modules” name=”position name” /> Example:
<?php if ($this->countModules( ‘newposition’ )) : ?>
<div class=”class_name”>
<jdoc:include type=”modules” name=”newposition” />
</div>
<?php endif; ?>
The countModules method can be used within a template to determine the number of modules enabled in a given module position. This prevents empty regions from being defined in the template output. You can add style for class_name in css file.
Note: In some joomla templates content are rendered from layouts folder in index.php <your Joomla! home>/templates/layouts
Step 3: Edit the file templateDetails.xml
Go to <your Joomla! home>/templates/template_name/ templateDetails.xml |
Open the Template’s templateDetails.xml file and find the <positions></positions> start and end tags .Then add the new position <position>newposition</position>
Ensure that the name of the module matches the module position you added to the index.php file in step 2.
Example: <positions> <position>position-0</position> <position>position-1</position> <position>position-2</position> <position>position-3</position> <position>position-4</position> <position>position-5</position> <position>position-6</position> <position>newposition</position> </positions>
The new positions should now be available in the module manager and modules can now be assigned. Once assigned they will appear on your template.
To visualize all modules set on a template by calling the “tp=1” query string on the front-end. For that you need to enable the module position in admin.
Go to template manager→ click options → enable preview module position
After that you can see all of the existing template locations in your browser by adding “?tp=1” to the end of your normal URL.
Note: Only Joomla 1.6,1.7&2.5 has GUI mode to enable/disable the Preview module position in back-end. Joomla 1.5 Doesn’t have this option. you can directly append “?tp=1”
(for example, “http://www.yoursite.com/?tp=1“).
I’ve learn some excellent stuff about RIA functionality here, good to go with the points. Certainly worth for all the developers & thanks for the article
Dear Penny,
Glad you liked this post and stay tuned for more updates.
Thanks!
I like what you guys tend to be up too. Such clever work and coverage!
Keep up the awesome works guys I’ve you guys to my personal blogroll.
Hello Olej,
Hope you enjoyed this article, also check our other related articles too.
Hi everyone,
While adding the the initiative first node got error in looping functionality, then removed the mapping point of the module and I debugged and it’s working fine, thanks for the informational post, keep up posting these articles.
Dear Chum,
Hope the above information helped you to add a new module in joomla, also check our other articles too for more information.
Thanks!
Very good blog post. I am gonna implement this to my website. Stick with the concept! Thanks for the tips…
Good to hear from you Esther. Also check our other joomla related stuffs and make use of it.