Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

"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.

EarlSwille
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: "Show modules on all submenus of a menu item" not working properly

Hi Uwe,

In that case, do it like this:

$mappings = array(
  27=>"19, 22, 76"
);


Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

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.

EarlSwille
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

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";
  }
}

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10137
Newest User:
lexispoker1
Members Online:
0
Guests Online:
357

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