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.

 

Hide a module if one of 8 other module is activated

Hide a module if one of 8 other module is activated

If I want the module 154 to be the standard to shown if 153 or 155 is not activated how do you want me to do with php. I want a modul with english to be standard if person from a country we don´t have created a special module to be shown in english. If a danish person came there module 153 is activated and then the standard english 154 to be shown. I could name all the other countrys english but is very many I have to change everytime :-)

if ( $fromCountryId == "DK" ) return 153;
if ( $fromCountryId == "PH" ) return 155;
if ( $fromCountryId == "US" ) return 154;

Thanks it´s an amazing product you made.

fjernsyn01
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: Hide a module if one of 8 other module is activated

If you want to test for certain countries, but have a "fallback" for everyone else, do this:

if ( $fromCountryId == "DK" ) return 153;
if ( $fromCountryId == "PH" ) return 155;
if ( $fromCountryId == "US" ) return 154;
return 154; // default for everyone else.


The way this works is that as soon as the PHP code gets to a "return" statement, it won't go any further. So put the default one last.

If you want a default one to be shown for everyone, so Danish people get 153 and 154, Philippinos get 155 and 154, etc, then one way to do that is this way:

if ( $fromCountryId == "DK" ) return "153,154";
if ( $fromCountryId == "PH" ) return "155,154";


Or this way:

$m = array(); // set up a new list.
if ( $fromCountryId == "DK" ) return $m[] = 153;
if ( $fromCountryId == "PH" ) return $m[] = 155;
if ( $fromCountryId == "US" ) return $m[] = 157;
$m[] = 154; // add default to the end of the list
return $m; // $m will contain a list of any of the 1st ones, plus the default one.


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

Re: Hide a module if one of 8 other module is activated

Thanks so much for the help. It´s perfect

fjernsyn01
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Total Posts Today:
1
User Info:
 
Total Users:
10075
Newest User:
rsker57
Members Online:
0
Guests Online:
200

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