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 to php script a module

How to php script a module

I need to know how do I hide a module and replace it with another using Metamod. It should be a simple php script but unfortunately I am not that expert. Searched all over for it but no luck! Can anybody help please. Thank you.

RC2012
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: How to php script a module

Hi RC2012,

Please read the Quick Start guide: http://www.metamodpro.com/metamod/quick-start
That will explain the basics of how to prepare the modules.

Then:

1 - prepare the 2 "target" modules, by setting them to "menu assignment: none"
2 - create the MetaMod and put it in the module position that you want the other modules to appear in. Ensure it is published and set to some or all menu items
3 - use the following PHP as the basis of your PHP code in MetaMod:

if ( ... some conditions here, whatever you want to determine which module is going to display ...) {
  return XXX;
} else {
  return YYY;
}


Replace XXX with the module id of the module that you want to display when the condition succeeds, and YYY with the module id of the module you want to display when the condition does not succeed.

Does that help?

So you need to think about it slightly different to how you described it. Instead of thinking "I need MetaMod to hide a module and replace it with another one", you need to set up MetaMod as a switch that sometimes displays one module, and sometimes displays another. I haven't filled in all the PHP code above, as you didn't specify what the actual condition for showing the target modules would be.

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

Board Info

Board Stats:
 
Total Topics:
1689
Total Polls:
6
Total Posts:
5941
Posts this week:
1
User Info:
 
Total Users:
5348
Newest User:
towner4218
Members Online:
0
Guests Online:
147

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