tel: +2348055401551 (sms, whatsapp)
skype: tokunboajewole

Joomla Beez20 tutorial-7: how to add a new module position

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.



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"/>
   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"/>
   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:


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.





that’s all folks!

Add comment

Security code

I use Linux 24x7

Recent Comments