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.

 

[solved] How to hide a module

[solved] How to hide a module

Helo,

is there a way to hide a module?

I means...

Usually I use php condition:

if php condition then return XXX;

This show a module.

Is it possible something like;
if php condition then hide XXX;

Maybe I've made some comfusion and you can clarify me....

Thanks,
Mario

Edited By: metamodguy
30-Dec-13 22:39:19

manburg6
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: [solved] How to hide a module

Hi Mario,

The answer to your questions is: yes and no!

The usual way to use MetaMod is to return the module ID of the module you want to display in MetaMod, and it is assumed that this module does not already appear. You're already doing it this way.

With the free version of MetaMod this is the only way to do it. However, you can make this have the same effect as switching a module "off": just start with it turned off (e.g. set to a nonexistant module position, or set to menu items: none) and only include it if the condition is *reversed*.

e.g.
if (! php condition) return XXX;

So that effectively hides the module when the condition is true, and shows it when it is false.

With MetaMod PRO however, you can actually disable a module that was appearing somewhere on the page, even if it's in a different module position to the MetaMod. Here's how:

if (php condition) {
  $changes->mod(XXX)->disable();
}


Hope that helps,
Best regards,
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: [solved] How to hide a module

Thanks... this is exactly what I'm looking for.

MetaMod is the best piece of code I never met.

Happy new year and thank you!

Mario

manburg6
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: [solved] How to hide a module

You're welcome - and Happy New Year!

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

Board Info

Board Stats:
 
Total Topics:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10095
Newest User:
johnson58
Members Online:
0
Guests Online:
114

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