Using multiple Google Maps API keys when using domain aliases

From JReviews Documentation
Revision as of 11:09, 17 June 2011 by Jreviews (Talk | contribs) (Created page with "The add-on has a setting for only one API key. If you have alias domains pointed to your main site you will need one key per domain. The following hack will allow you to do that....")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The add-on has a setting for only one API key. If you have alias domains pointed to your main site you will need one key per domain. The following hack will allow you to do that.

  • /components/com_jreviews/jreviews/controllers/my_controller.php
function beforeFilter() {
 
   # Init Access
   if(isset($this->Access)){
      $this->Access->init($this->Config);
   }
 
   # Load a different google maps key for every domain alias
   switch($_SERVER['HTTP_HOST']) {
      case 'www.domain-alias.com':
         $this->Config->{'geomaps.google_key'} = 'Google Maps API Key for the domain alias';
      break;
   }