Reputation: 2349
I have a custom module which is set to show in all menus. Inside this module I have loaded a new module position named "leftcenter" using the code below.
<?php
$ad_module = &JModuleHelper::getModules( 'leftcenter' );
foreach ($ad_module as $ad_loader) {
$_options = array( 'style' => 'xhtml');
echo JModuleHelper::renderModule( $ad_loader);
}
?>
I can view the module assigned to this position when it is set to view in all menus but does not appear at all when it is set to show in selected menus only. Can someone help me as to why this is happening?
Upvotes: 0
Views: 170
Reputation: 8272
Try this
jimport('joomla.application.module.helper');
$mods = JModuleHelper::getModules('product_page');
echo JModuleHelper::renderModule($mods[0]);
also you should give modules assignment of the menus correctly from the module manager. that is why you don't get some menus. If your second module is appearing only in this module then you enable your second module to all menus. I hope this will solve your problem.
Upvotes: 1
Reputation: 4711
You can simply do this by using this line of code by putting in to you module.
<jdoc:include type="modules" name="leftcenter" />
You will get all the module inside that module which assign to that particular position.
Upvotes: 0