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 Geo IP module content spesific to country ?

How to Geo IP module content spesific to country ?

I have opt in form that that collect e-mail of my visitors.

The formast are both in HTML and Javascript versions.

Question 1: How to put HTML and also Javascript codes inside of the module?
or should i put these codes into a HTML Joomla module and then configure it to be shown instead of the meta mod?


Question 2:

I want to show forms variations depending on visitor's country.

1) one form to US and
2) another form to Canadians ,
3) other form to Australia, New Zeland ,
4) other form to UK,
5) All Other countries should see version 5 of the form

What is the code lines?  Please.
Thank you for MetamodPro. I love it.

Edited By: alexmartin
22-Jun-12 21:36:15

alexmartin
Junior Modder
ranks
useravatar
Offline
31 Posts
Administrator has disabled public posting

Re: How to Geo IP module content spesific to country ?

Hi Alex,

personally I would make separate modules for each of these options, and put the JS/HTML in them. That keeps the code separate from presentation, and should make it easier to edit the JS/HTML without disturbing the "logic" side of it.

Then, download the GeoLiteCity database from MaxMind, unzip it, and put it into a folder called geoip in the root of your web directory.

Then create your MetaMod, and enable the GeoIP COuntry support in it. I assume you know how to set up your target modules etc. (i.e. unpublishing them or setting them to display on no menu items).

For the MetaMod PHP code I would do the following:

switch ($fromCountryId) {
  case 'US': return AAA;
  case 'CA': return BBB;
  case 'AU':
  case 'NZ': return CCC;
  case 'GB': return DDD;
  default: return EEE;
}


Replace the AAA-EEE above with the module ids that you want to use for each of the countries specified. EEE is the "fallback" (i.e. for all other countries). See how you can have several countries mapping to one module by stacking them on top of each other without a return statement, like the AU-NZ example above.

Best regards,
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

Re: How to Geo IP module content spesific to country ?

metamodguy wrote:


Then, download the GeoLiteCity database from MaxMind, unzip it, and put it into a folder called geoip in the root of your web directory.

Then create your MetaMod, and enable the GeoIP COuntry support in it. I assume you know how to set up your target modules etc. (i.e. unpublishing them or setting them to display on no menu items).

For the MetaMod PHP code I would do the following:

switch ($fromCountryId) {
  case 'US': return AAA;
  case 'CA': return BBB;
  case 'AU':
  case 'NZ': return CCC;
  case 'GB': return DDD;
  default: return EEE;
}


Replace the AAA-EEE above with the module ids that you want to use for each of the countries specified. EEE is the "fallback" (i.e. for all other countries). See how you can have several countries mapping to one module by stacking them on top of each other without a return statement, like the AU-NZ example above.

Best regards,
Stephen

Hi,

Is it GeoLiteCity.dat or GeoIP.dat we have to copy into the folder joomla_root/geoip/?

Then do we have to enable GeoIP or GeoLite City?

Thanks and regards

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

Re: How to Geo IP module content spesific to country ?

If you want to detect cities then use GeoLiteCity.dat, otherwise use GeoIP.dat (i.e. just for countries) as it will be quicker and more lightweight for the server.

Then enable whichever one you installed, in any MetaMod that needs to use the information. By requiring it to be enabled this means that if it DOESN'T need it then it will same some processing time.

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:
1685
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5193
Newest User:
david2398
Members Online:
1
Guests Online:
104

Online: 
Technichem

Forum Legend:

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