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.

 

Enable/disable metamod dynamicly according to php rule

Enable/disable metamod dynamicly according to php rule

Hi there smile

I wonder if the free edition of Metamod is able to be enabled and disabled dynamicly according to a chosen php rule?

I have a page with a fixed-size template, using both left and right position for modules. since im going to run both Seminar and Kunena forum then the main content space is too small, therefore i was hoping it was possible to use metamod to hide the modules in the right position AND itself when clicking on either the forum or seminar link. when one navigates away from the forum or seminar then metamod and its included modules has to be re-enabled again smile

hopes my explanation makes any sense smile
thanks in advance

Im running 1.5.20 btw.

Best regards
Glenn smile

CodeKungFU
Beginner Modder
ranks
useravatar
Offline
1 Posts
User info in posts
Administrator has disabled public posting

Re: Enable/disable metamod dynamicly according to php rule

Hi Glenn,

The answer is "yes" you can do this with MetaMod. It's also most likely you you might need MetaMod Pro as well, because you are dealing with left and right columns. This is because templates will often check to see if there are any published modules in the left or right column, and if there are, then they will reserve space for the column (if not, then they won't reserve space, and the main content can expand to full width). What happens with MetaMod, unless you are using MetaMod Pro, is that because you publish a MetaMod into the left or right column, your template always thinks that there's a published module in there (the MetaMod), so it always reserves space, even if the MetaMod doesn't include any of the other modules and displays as an empty space. MetaMod Pro prevents that from happening.

Anyway, that aside, here's how I would do what you're asking for:

1 - edit all of the modules that were in the right column, and change their module position to "right-metamod" instead of "right". You can type this in directly instead of using the drop-down, when editing each module.

2 - do the same for "left" column modules - chance the module position to "left-metamod".

3 - create a MetaMod and put it into the "right" module position (NOT "right-metamod"). Give it a title but turn the title off. In this one, use the following rule:

if ( $option != "com_kunena" and $option != "com_seminar" ) return "right-metamod";

4 - do the same for the left column - make a new MetaMod and use the following rule:

if ( $option != "com_kunena" and $option != "com_seminar" ) return "left-metamod";

[Note: in both of these I am assuming that the module name of the "seminar" component you mentioned is "com_seminar". That's just a guess - you'll need to find out the right name and use it in the rule.]

Now what should happen is that the Metamod, which is assigned to ALL pages, will always check first to see if the current component is Kunena, Seminar, or something else. If it's neither Kunena nor Seminar, then it will pull in all the modules from the "right-metamod" or "left-metamod" module positions, and add them to "right" or "left" as appropriate.

If you want to add more modules to the left or right columns, just add them to "left-metamod" or "right-metamod" as appropriate, so that the MetaMods will include them correctly.

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

Board Info

Board Stats:
 
Total Topics:
1722
Total Polls:
6
Total Posts:
5933
Total Posts Today:
6
User Info:
 
Total Users:
4928
Newest User:
jcornejo
Members Online:
0
Guests Online:
155

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