Question

I want to be able to assign multiple modules in a particular position but display only two of them at any given time in joomla. How do I be do that ?

Was it helpful?

Solution

After some research I found out that one can use the below code to do it.

$arrayofmoduleObj = JModuleHelper::getModules('position') // to get an array of module Object.
$options    = array('style' => 'chrome');
foreach($arrayofmoduleObj as $moduleObject){
    /* code to decide whether to print this module or not if yes    */
    echo JModuleHelper::renderModule($moduleObject,$options) //to render a module Object..
   else continue;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top