Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » "Show modules on all submenus of a...
"Show modules on all submenus of a menu item" not working properly
"Show modules on all submenus of a menu item" not working properly
Hello, when using the recipe "Show modules on all submenus of a menu item" the following does not work:
Code:
$mappings = array(
27=>19,
27=>22,
27=>76
);
/* You should not need to edit anything under here */
$menu = &JSite::getMenu();
if (empty($Itemid)) {
$menuItem = &$menu->getActive();
} else {
$menuItem = &$menu->getItem($Itemid);
}
$tree = $menuItem->tree;
$all_modules = array();
foreach ($tree as $value) {
if (array_key_exists($value, $mappings)) $all_modules[] = $mappings[$value];
}
return $all_modules;
When item 27 is active, only the last of the listed modules (in this case module with id 76) is shown, not all (19 & 22), as expected.
Using:
Code:
$mappings = array(
27=>19,
24=>22,
15=>76
);
works fine.
Any idea?
Thanks,great module, Uwe.
Re: "Show modules on all submenus of a menu item" not working properly
Re: "Show modules on all submenus of a menu item" not working properly
Hello Stephen,
thank you for your quick reply.
metamodguy wrote:
$mappings = array(
27=>"19, 22, 76"
);
Unfortunately this only gives me the first module (id 19), not 22 & 76.
Any other idea?
Thank you,
Uwe.
Re: "Show modules on all submenus of a menu item" not working properly
Oh, yes, now I look at that I can see why. Sorry I gave you wrong information.
Try this instead. It doesn't use the $mappings array any more, as it just checks for the exact value you asked for (27):
Code:
$menu = &JSite::getMenu();
if (empty($Itemid)) {
$menuItem = &$menu->getActive();
} else {
$menuItem = &$menu->getItem($Itemid);
}
$tree = $menuItem->tree;
foreach ($tree as $value) {
if ($value == 27) {
return "19,22,76";
}
}
- Index
- » MetaMod
- » MetaMod General Support
- » "Show modules on all submenus of a...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7627
- Newest User:
- rudys68879
- Members Online:
- 0
- Guests Online:
- 184
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked