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.

 

Using only one Metamod module to publish one GEO IP region?

Using only one Metamod module to publish one GEO IP region?

Hi
checking the docs for Metamod Pro:
http://www.metamodpro.com/metamod/quick-start

I have 4 english language regions (Asia, America, UK, rest of the world) and 5 module areas Bottom1 - Bottom5.
I want to have different modules showing in each area. Does this mean I have to do 4 x 5 metamod modules to achieve this in total 20 modules?

Is there no way to do this with just one Metamod module per region?
In other words creating those bottom1-5 modules and assigning them to bottom 1-5 module positions, then using 4 Metamod modules to create the Country Code settings and adding all module ID's that show up in that region. This would mean creating only 4 Metamod modules instead (4 regions) of 20 metamod modules (5 modules x 4 regions).

Is there a way to use Metamod so that One Metamod published all 5 modules in the regions at once?

Greetings, Anne

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

Re: Using only one Metamod module to publish one GEO IP region?

Hi Anne,

thanks for your question.

Since you're using the Pro version, you actually get some more flexibility in module positions than you do in the free version. Let me explain.

You can use the Module Parameter Control system to tell modules to appear in a different position. This means that you can return a list of module ids from a MetaMod in position "X", but make the modules actually appear in position "Y".

See http://www.metamodpro.com/metamod/contr … parameters

Here are 2 approaches, the first is simplest to understand and just requires 1 MetaMod per module position (5 in all), and the second uses 1 MetaMod overall.

Approach 1: One MetaMod per position

In this approach you create all your "target" modules and set them to appear on "Module Assignment: no pages".
Then create 1 MetaMod for each of the module positions, 1-5.
In each you have similar PHP code which does the following:
- calculates which region the visitor is in (I assume using GeoIP?)
- based on that, returns the relevant module out of the 4 regions for that position.

e.g.
// first calculate the $region code however you want to do that (leaving that to you for now)
// ........
// Then switch based on the region:
if ($region == 'Asia') return 101; // module for position 1 region 1
if ($region == 'America') return 102; // module for position 1 region 2
if ($region == 'UK') return 103; // module for position 1 region 3
if ($region == 'ROW') return 104; // module for position 1 region 4

Then do the same thing in the 2nd MetaMod, in position bottom 2, and change the module numbers to correspond to the ones to use for that position.

Approach 2: doing it all in 1 MetaMod:

// first calculate the $region code however you want to do that (leaving that to you for now)
// ........
// Then return the list of 5 modules for the 5 positions, but also "instruct" each one about which position to appear in:
if ($region == 'Asia') {
  $changes->mod(101)->position("bottom 1");
  $changes->mod(102)->position("bottom 2");
  $changes->mod(103)->position("bottom 3");
  $changes->mod(104)->position("bottom 4");
  return "101,102,103,104";
}

if ($region == 'America') {
  $changes->mod(201)->position("bottom 1");
  $changes->mod(202)->position("bottom 2");
  $changes->mod(203)->position("bottom 3");
  $changes->mod(204)->position("bottom 4");
  return "201,202,203,204";
}

if ($region == 'UK') {
  $changes->mod(301)->position("bottom 1");
  $changes->mod(302)->position("bottom 2");
  $changes->mod(303)->position("bottom 3");
  $changes->mod(304)->position("bottom 4");
  return "301,302,303,304";
}

if ($region == 'ROW') {
  $changes->mod(401)->position("bottom 1");
  $changes->mod(402)->position("bottom 2");
  $changes->mod(403)->position("bottom 3");
  $changes->mod(404)->position("bottom 4");
  return "401,402,403,404";
}


Ok, the PHP code can be streamlined a lot, but I have written it out longhand like that to make it easier to understand.

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

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10112
Newest User:
chris28464
Members Online:
0
Guests Online:
153

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