TNG Event Search

From Genwiki

Jump to: navigation, search

If you are not comfortable with html and php editing, this page may not be for you

Event Place Search Form

This mod is now distributed under the Mod Manager. Please refer to the Event Search Place page on the TNG Wiki for the latest version.

If you want to add this mod for an earlier verison of TNG and provide a simple/integrated way for your users to search your Events for common place names, try adding this form to the bottom of your search page. If you are comfortable with a text editor, you can add this to your existing TNG search page in just a few minutes.

TNG Version 7.1.0 - Code support for this mod is now contained in the Mod Manager module
Rev 1.2 - Jul 1, 2008 - Updated installation instructions for TNG V7.0.0
Rev 1.1 - Jul 11, 2007 - Updated installation instructions for TNG V6.1.1, validated up to V6.2.0
Rev 1.0 - May 14, 2007 - minor instruction update for TNG V6.1.0
Initial release - Jan 21, 2007

What are Event Places

When you enter a place location associated with a Birth, Death, Burial, Marriage, Divorce, or other Event, it is associated with your specific person record. These locations may be searched to find other people that have the locations associated with them. TNG version 6 has a built in feature to find exact matches for this type of search. The grey magnifying glass next to locations will provide the results of an exact match to the location it is next to. This mod will allow you to do a similar search, but in a more general matching scheme.


To see how this works and how the form will look on your search page, you can preview it on my site at My Search Page at the bottom of the page.
For this example, try typing "Tiverton" without the quotes in the first search field. It will return all locations that have this in the place field.
You could also type just "Tiver" and achieve the same results.
Try entering "Tiverton" in the first field, and "Cemetery" in the second field. You get the idea.


  1. A working TNG installation - see The Next Generation of Genealogy Sitebuilding
  2. A backup of your TNG searchform.php file.

TNG Modifications for TNG V6-V7

The following zip file contains the single placesearchform.php file.

  • The zip file contains 1 file:
    • placesearchform.php - the Events - Place search form to be included in the TNG searchform.php file

  1. backup your existing TNG searchform.php and placesearch.php files
  2. download this zip (
  3. unzip it, examine the contents
  4. find and open your original searchform.php file
    • edit the last few lines of the file
      • change the last lines from this
 <br /><br />
 tng_footer( "" );
  • to this
 <?php @include($cms[tngpath] . "placesearchform.php"); ?>
 <br /><br />
 tng_footer( "" );
  • you can copy the single line above from this page and paste it into your file
  1. close your searchform.php file and copy it to your base TNG directory
  2. find and open your original placesearch.php file
    • The first change is 'NOT' required for V6.2.0 or higher. For V6.0 and V6.1.0 find the following line (V6 about line 173, V6.1.0 about line 204) and change this
        $allwhere .= " AND ($place1 = '$psearch' OR $place2 = '$psearch')";
    • to this
        $allwhere .= " AND ($place1 LIKE '$psearch' OR $place2 LIKE '$psearch')";
    • you can copy the single line above from this page and paste it into your file

    • then For all versions find the following line
      • V6.0 - line 180
      • V6.1.0 - line 211
      • V6.1.1 - line 355
      • V6.2.0 - line 224
      • V7.0.0 - line 212
      • V7.0.3 - line 114 (the variable is $allwhere2)
    and change this
    		$allwhere .= " AND $place = '$psearch'";
    • to this
    		$allwhere .= " AND $place LIKE '$psearch'";
    • you can copy the single line above from this page and paste it into your file

    1. close your placesearch.php file and copy it to your base TNG directory
    2. for each of your supported languages, add the following two lines of code into cust_text.php
      • cust_text.php will be located in the directory "English" in your main TNG directory
      • add the following two lines in the middle of the file.
          $text[eventscont] = "Place containing";
          $text[andcont] = "And containing";
      • you can copy the two lines above from this page and paste it into your file
    3. copy the supplied placesearchform.php to your base TNG directory
      • ensure the placesearchform.php is readable by all
    4. check it out

    • In the event of a problem with your TNG site
    1. copy your backup searchform.php and placesearch.php files to your base TNG directory
      • all should be well now
    2. you may also delete the supplied placesearchform.php file


    Thanks go out to Lee Drew who came up with the idea and prompted me to code it. He may be contacted via the tnguser2 mailing list.


    1. You're sort of on your own... If you have a specific question, or feel some additional info in the above would help others, feel free to contact me directly. Mail me here
      • Please post suggestions, or your own flavour of this mod to the forum or list
Personal tools