Genealogy - Site Notes

Home Page

TNG Modifications - GTS010

Designed for TNG 8, should work for TNG 7 versions.

This modification allows multiple Goggle map keys to be defined for use when a TNG web site is accessed using multiple domain names (e.g. gsmall.us and gsmall.org).

Administration/Setup/Configuration/Map Settings edits various settings for Google maps. TNG 8.0.0 provides for setting only one Goggle Maps API key for the primary host name used to access the TNG web site. Rather than modify the TNG source to provide entry of multiple keys, this modification uses the mod_manager now built-in to TNG 8 to directly modify the mapconfig.php file that sets the key to be used.

The Google Maps API Version 2 requires a separate key for each host domain name. So for example "gsmall.us" and "gsmall.org" require two different keys, but "www.gsmall.us" and "gsmall.us" do not. So to use this modification you must:

  1. Edit the mods/mapconfig-googlemultihost_V8.0.0-20100619.cfg file with a plain text editor such as Windows notepad or UNIX vi to specify the key for each domain name that is used to access your TNG web site. See the example below.
  2. If your site uses multiple host names within your domain, then you must include duplicate keys for each name.  For example, many sites will add www to the domain name, so although "www.gsmall.us" and "gsmall.us" are the same as far as Google Maps is concerned, the web server and PHP see them as different.
  3. Put the edited mapconfig-GoogleMultiHost_V8.0.0-20100619.cfg in the mods folder of your TNG 8 web site.
  4. If you changed the Config Path setting, you also need to edit the mod file line "%target::mapconfig.php%" to show the relative path from Root Path, for example %target::example/mapconfig.php%"
  5. Log in as Administrator on your site, go to Mod Manager, and run the installation of this modification.
  6. Any time you change the map settings with Administration/Setup/Configuration/Map Settings, you need to go to Mod Manager and reinstall this modification.

This modification will no longer be necessary when TNG is updated or modified to use the new Google Maps API Version 3. Version three does not require keys.

Download "mapconfig-googlemultihost_V8.0.0-gts010-20100619.cfg".

Example:

To edit the keys, note the domain name after "$mapkey[" and the key after the equals sign. The domain name should be in single-quotes and the key in double quotes. If you have more than two names, simply make copies of those lines and edit the name and key. You will probably use cut-and-paste for the keys.
$mapkey[strtolower($_SERVER['HTTP_HOST'])] = $map['key'];//gts010
$mapkey['gsmall.us'] =     "ABQIAAAA0Jb1t6Y0D4BGRR66fMsZABT1O7m4R-oyjR33MdPoc2gAmQmQWhTNLSi_B9NaKuORFhMRiLxUyiNQDg";//gts010
$mapkey['www.gsmall.us'] = "ABQIAAAA0Jb1t6Y0D4BGRR66fMsZABT1O7m4R-oyjR33MdPoc2gAmQmQWhTNLSi_B9NaKuORFhMRiLxUyiNQDg";//gts010
$mapkey['ohio.shnw.net'] = "ABQIAAAA0Jb1t6Y0D4BGRR66fMsZABSpYvjEGQ3blaA9bo6PvA8Jn0qOPxSuGjgWvDnzP1q2rGnG5p2opInVcg";//gts010
$map['key'] = $mapkey[strtolower($_SERVER['HTTP_HOST'])];//gts010

  1. You may find it convenient to add spaces after the equals-sign so that the keys line up. This makes it easier to see if you have entered the key correctly. They are usually similar but not identical, and are always the same length.
  2. Note that the key for "gsmall.us" and "www.gsmall.us" are the same.
  3. The above example can be edited and inserted before the last line of mapconfig.php in TNG 7 version without mod-manager. However, any time  Administration/Setup/Configuration/Map Settings is used, the change will have to be inserted again so save a copy to make the insertion simple.

Page modified: 17 Jan 2011 11:42:53 -0800

[Back to Top Send comments or questions to Contact Me. [Home Page]