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.

 

how can i remove module from particular menu items?

how can i remove module from particular menu items?

Hi There!
how can i remove module from particular menu items?
i know i can do that in joomla, but i'm dealing with buggy module which shows on pages i want only if i eanble it for all. So now it's enabled for all menu items and i want to exclude it from particular menu items.
Thanks in advance!

dup
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

Ok, i will ask in a different way. How can i tell metamod to show particular module only on particular menu items?
Any help would be very much appreciated!

dup
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

Hi dup,

there are many ways to set this sort of thing. But if you want to base it on particular menu items (which usually means certain Itemids), then you can achieve it like this:

if ($Itemid == 1 or $Itemid == 2 or $Itemid == 3) return; // i.e. do nothing, short-circuit!
return 101; // show module 101

In this example, you detect the particular Itemids that you don't want it to display on (1, 2 and 3 in this example). If it equals one of these then no module is shown (return without a module id). Otherwise, it falls through to the next line and returns your target module (101 in this case).

I would recommend that you turn on MetaMod "advanced debug" mode with MetaMod assigned to ALL pages, and then view your site. See what the MetaMod debug outputs. You may see that there are no Itemids, or possibly other URL parameters that you can test for if the Itemids are messed up for some reason.

Hope that helps,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

Thanks!
And if i WANT to display it on particulat itemids (do the opposite) what would be the code?

dup
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

if ($Itemid == 1 or $Itemid == 2 or $Itemid == 3) return 101; // show module 101 on these Itemids

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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

thanks that does work, but i should put that module 101 Menu Assignment to "None"

But my problem is: that buggy cart module that i want to fix, doubled on a page for some reason in different positions if i put Menu Assignment to "None" or "Select Menu Item(s) from the List". It only behaves correctly if Menu Assignment set to "All" (this is not related to metamod, that's the module bug which i want to fix)

That's why i was hoping that metamod will help to get a solution. So my question: how can i setup metamod to work when Menu Assignment for that module set to "All"??

Now it just adds the copy of the same module in that case on requested pages, but the original module is still there.

Thanks for your help!

dup
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

I created metamod rule to disable particular module on some menu items. But the module is still there. May be i made a mistake in a code? Here is the code:

if ($Itemid == 83 or $Itemid == 85 or $Itemid == 128 or $Itemid == 129 or $Itemid == 130 or $Itemid == 131 or $Itemid == 132 or $Itemid == 141 or $Itemid == 142 or $Itemid == 143 or $Itemid == 144 or $Itemid == 145 or $Itemid == 146) return; // i.e. do nothing, short-circuit! return 60; // show module 60

Module 60 is still there sad

dup
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: how can i remove module from particular menu items?

Hi,

there are several ways you can address this, even if you keep the (buggy) module set to ALL pages. The point is that you need to find some way to stop it showing on the page until/unless MetaMod includes it.

So the other main way is to set it to a non-existant module position. e.g. instead of "left", set it to a module position called "left-metamod" just so you know where you want it to appear, but Joomla won't go and assign it until the MetaMod pulls it in.

So then you put a MetaMod into the "left" position, publish it, and use the PHP code above.

Also, since you are using PHP code, please ensure that you leave the "quick module id or position include" box BLANK.

Hope that helps,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10789
Newest User:
parus6
Members Online:
1
Guests Online:
213

Online: 
parus6

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked