If you are working with Joomla, You have to know about Module Position because its basic functionality you have to use within a template. Sometimes we need to create a new module position in a Joomla template.Module Position is necessary to display modules into the template.
In Joomla, You have to know about Module Position because its basic feature you have to use within a template. even you need to add the new position for new Joomla site.Module Position is necessary to display modules into the template
There are two ways to load the modules in Template of Joomla.
- Without Conditions
- With conditions
First of all, To load Module without condition in template, you just need to add below line of code:
Conditional Module position is specifically useful when you want to have a different layout.Like on some specific condition, you want to load the module.
To load Module with the condition, you have to use if() statement of PHP before you load the module.
Let’s have a look how to count the number of a single module, you can execute a method like:
if ($this->countModules(’module_position’)) :
You can use the same method to count the multiple modules like this:
$this->countModules('module_position1 + module_position2');
In above code, the countModules() function will help you determine enabled modules within a template reference on the current page.