Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.


alexmartin
Beginner Modder
ranks
useravatar
User Info

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

Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting
MoonDragon
Beginner Modder
ranks
useravatar
User Info

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


Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 3089  Total Topics: 1195  Total Polls: 7  Total Posts: 4450  Total Posts Today: 2
User Info:   Newest User :  aledex957   Members Online: 2   Guests Online: 88
Online 
Jeff78aledex957
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked