TNG Integration Search2

From Genwiki

Jump to: navigation, search

Place String Search / Match Strategy 2

(Approach and code provided by Roger Navarre (see TNG list for email address))

This version of the "link_wiki.php" file differs in it's approach to Location Strings and how it tries to match the GenWiki pages.
These files only work with Revision 3 or higher of the GenWiki mod which assumes the GenWiki tables were installed into the TNG database.

This approach was developed by Roger Navarre and works very well for well structured location strings. This approach is targeted at location strings with the following format:

town, county, state/province, country

The link_wiki.php file includes a parsing function that has been setup in a table fashion to allow easy customization by individual TNG site managers.

Search / Match Strategy

Although the parse function should be modified for local database needs, the following default approach is included and may work well for many.

Given that a place name may have four elements, separated by commas:

city, county(or parish), state, country; there are 16 possibilities:

Case# City County State Country produces
0 N N N N "" - empty string
1 N N N Y Country
2 N N Y N State
3 N N Y Y State [, Country] - country added if not USA or Canada
4 N Y N N xxxx County
5 N Y N Y xxxx County [, Country] - country added if not USA or Canada
6 N Y Y N xxxx County, State
7 N Y Y Y xxxx County, State
8 Y N N N City (or whatever the 1st parm is)
9 Y N N Y City [, Country] - country added if not USA or Canada
10 Y N Y N City, State
11 Y N Y Y City, State
12 Y Y N N City, xxxx County
13 Y Y N Y City, xxxx County
14 Y Y Y N City, State
15 Y Y Y Y City, State

Additional Rules

  • If City ends with "Township" the "Township" is removed
  • If City begin with "near" the word "near" is removed
  • If County does not contain "County" or "Parish", " County" is appended to it
  • Countries named "USA" "United States" or "Canada" are ignored (unless country is one of only 1 or 2 parms presented


  1. backup your existing "link_wiki.php"
  2. Download the Strategy 2 zip file
    • It contains one file
      • the replacement "link_wiki.php" file
  3. extract and edit the "link_wiki.php" file options to match your GenWiki installation
  4. view/edit the parsePlaceName function to handle any custom place names you may encounter in your database
  5. copy the link_wiki.php file to your base TNG directory
  6. enjoy...
Personal tools