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.

 

Either or?

Either or?

This is my scenario: I want to show a module if either the country is FR or if the language is fr.

I tried many combinations and can't make it work, for example I set module ID 274 to be displayed if country matches FR (in the parameter 'only these countries'), and also added on the PHP section if ( $language_code == 'fr') return 274; . That does not work... if country is US and language is fr, the module does not display.

I also tried removing the country from 'only these countries', and just using PHP:
if ( $language_code == 'fr') return 274;
if ( $fromCountryId == "FR") return 274;
but that does not work either, the module never displays.

I am doing something wrong, or what I want is not possible?

jossif
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Either or?

I got it now, this works:
if ( $language_code == 'fr') return 274;
if ( $fromCountryId == "FR") return 274;

... as long as I remove list of countries and have no IDs set

Great!

jossif
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Either or?

Yes, you got it!

The "list of countries" for inclusion/exclusion operates before the PHP is run. If a connection fails the inclusion/exclusion test then the PHP won't even get looked at.

The "quick module id include" box generally shouldn't be used if you're using PHP rules. Any ID that you add in there will be included (or rather, that module will be included) after any modules included by the PHP.

In other words MetaMod works something like this:

- checks dates and times. If not within this time period, aborts.
- checks "include/exclude" countries. If not included, or if excluded, then aborts.
- runs PHP code if any, and makes note of which module ids or positions were returned.
- displays all modules that were returned by the PHP code, plus any in the Quick Module ID include box.

Hope that makes sense.
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
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4388
Newest User:
wilmer7878
Members Online:
2
Guests Online:
142


Forum Legend:

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