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.

 

Test Geolocation - Support for Geocities

Re: Test Geolocation - Support for Geocities

I will also use the logic for all the templates in one module as you indicated.

Cheers.

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Test Geolocation - Support for Geocities

Any corrections regarding this coding, for the inclusion of the country?

Code:


$mainframe =& JFactory::getApplication();
$template =& $mainframe->getTemplate();
$city = $geoip->city;

if ( $template == "electric_standard_jan2011" ) {

  if ( $fromCountryId == "CA" )
  return 447; 

    if ( $city == "Charlesbourg" ) return "450";
    if ( $city == "Quebec" ) return "458";
    if ( $city == "Beauport" ) return "459";
    if ( $city == "Lévis" ) return "460";
    if ( $city == "Montreal" ) return "461";
    if ( $city == "Neufchatel" ) return "462";
    if ( $city == "Sainte-foy" ) return "463";
    if ( $city == "Sillery" ) return "464";
    if ( $city == "Vanier" ) return "465";
    return 447;
}


atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Test Geolocation - Support for Geocities

I'd do it this way:

Code:

$mainframe =& JFactory::getApplication(); 

$template =& $mainframe->getTemplate();
$city = $geoip->city;

if ( $template == "electric_standard_jan2011" ) {
  if ( $fromCountryId == "CA" )  {
    if ( $city == "Charlesbourg" ) return "450";
    if ( $city == "Quebec" ) return "458";
    if ( $city == "Beauport" ) return "459";
    if ( $city == "Lévis" ) return "460";
    if ( $city == "Montreal" ) return "461";
    if ( $city == "Neufchatel" ) return "462";
    if ( $city == "Sainte-foy" ) return "463";
    if ( $city == "Sillery" ) return "464";
    if ( $city == "Vanier" ) return "465";
    return 447;
  }
  return XXX; // backstop for countries other than Canada, in same template
}
return YYY; // default for any other template

This way, the city names only get checked if you know it's in Canada.

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: Test Geolocation - Support for Geocities

Seems to be working well even I can't test it from other locations.

Here it is:

Code:


$mainframe =& JFactory::getApplication();
$template =& $mainframe->getTemplate();
$city = $geoip->city;

if ( $template == "electric_standard_jan2011" ) {
  if ( $fromCountryId == "CA" )  {
    if ( $city == "Charlesbourg" ) return "450";
    if ( $city == "Quebec" ) return "458";
    if ( $city == "Beauport" ) return "459";
    if ( $city == "Lévis" ) return "460";
    if ( $city == "Montreal" ) return "461";
    if ( $city == "Neufchatel" ) return "462";
    if ( $city == "Sainte-foy" ) return "463";
    if ( $city == "Sillery" ) return "464";
    if ( $city == "Vanier" ) return "465";
    return 447;
  }

  return 447; // backstop for countries other than Canada, in same template

}

if ( $template == "femmes_jan2011" ) {
  if ( $fromCountryId == "CA" )  {
    if ( $city == "Charlesbourg" ) return "450";
    if ( $city == "Quebec" ) return "458";
    if ( $city == "Beauport" ) return "459";
    if ( $city == "Lévis" ) return "460";
    if ( $city == "Montreal" ) return "461";
    if ( $city == "Neufchatel" ) return "462";
    if ( $city == "Sainte-foy" ) return "463";
    if ( $city == "Sillery" ) return "464";
    if ( $city == "Vanier" ) return "465";
    return 447;
  }

  return 447; // backstop for countries other than Canada, in same template

}


if ( $template == "metal_jan2011" ) {
  if ( $fromCountryId == "CA" )  {
    if ( $city == "Charlesbourg" ) return "450";
    if ( $city == "Quebec" ) return "458";
    if ( $city == "Beauport" ) return "459";
    if ( $city == "Lévis" ) return "460";
    if ( $city == "Montreal" ) return "461";
    if ( $city == "Neufchatel" ) return "462";
    if ( $city == "Sainte-foy" ) return "463";
    if ( $city == "Sillery" ) return "464";
    if ( $city == "Vanier" ) return "465";
    return 447;
  }

  return 447; // backstop for countries other than Canada, in same template

}


Cheers.

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1688
Total Polls:
6
Total Posts:
5939
Dormant:
User Info:
 
Total Users:
6881
Newest User:
kaunbanegacrorepati
Members Online:
0
Guests Online:
85

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