In this post, I will try to explain how to add an “easy” module position. I call it easy because its as easy as a giveaway.

Fig-1 below is a module position preview of Beez20. If you don’t know how to preview a template’s module positions, read this tutorial.

A quick location to add a new position is directly below the content area. The new module position would just be a duplicate of module position#12 which is above the content area.

Fig-1

joomla beez20-7-1

To add this new module position, we need to modify our 2-files: index.php and templateDetails.xml

a) Index.php

Open your index.php file and locate this code:

<div id="main">
php if ($this->countModules('position-12')): ?>
<div id="top">
<jdoc:include type="modules" name="position-12"/>
div>
php endif; ?>
<jdoc:include type="message" />
<jdoc:include type="component" />
div>-- end main -->

Explanation: the above code checks to see if there are any modules(countModules) published in position-12. If there is, the module will be displayed above the content area(component). Since we just want to add another module position below the content, we can as well duplicate everything inside the php tags, as follows:

<div id="main">
php if ($this->countModules('position-12')): ?>
<div id="top">
<jdoc:include type="modules" name="position-12"/>
div>
php endif; ?>

<jdoc:include type="message" />
<jdoc:include type="component" />

php if ($this->countModules('myNewModulePosition-1')): ?>
<div id="top">
<jdoc:include type="modules" name="myNewModulePosition-1"/>
div>
php endif; ?>
div>-- end main -->

where “myNewModulePosition-1 is the name for the new module position. Save index.php

b) templateDetais.xml:

Edit templateDetails.xml and add the new module position at the bottom of the positions list:

<positions>
<position>debugposition>
<position>position-0position>
<position>position-1position>
<position>position-2position>
<position>position-3position>
<position>position-4position>
<position>position-5position>
<position>position-6position>
<position>position-7position>
<position>position-8position>
<position>position-9position>
<position>position-10position>
<position>position-11position>
<position>position-12position>
<position>position-13position>
<position>position-14position>
<position>myNewModulePosition-1position>
positions>

Save templateDetails.xml

c) publish a module in the new position: head on over to EXTENSIONS >> EXTENSION MANAGER and find a module to publish at the new position. For this tutorial, I have prepared a banner(Fig-3) to be published at the new position.

Fig-2:

joomla beez20-7-2

Fig-3:

joomla beez20-7-3

that’s all folks!

You have no rights to post comments