dhhughes.org family tree - How It Works

The HTML files used by this web site were generated by a Perl script that reads a GED file generated by the Legacy Family Tree software. The Perl script has no imbeded HTML code, but reads "model" files that contain the HTML syntax. Here are the steps required to generate the HTML files:

1) In the Legacy Family Tree software, navigate to File->Export->GEDCOM File, and enter the filename for the GED file. For this example use "mydemo". Do not specify a compiler. Note that the gentree.pl Perl script as it is currently written assumes the GED file contains level 0 records as generated by the Legacy Family Tree software:
0 @Innn@ INDI
0 @Fnnn@ FAM
where nnn is a number greater than 0. Copy the Documents/Legacy Family Tree/Data/mydemo.ged file to the directory where the Perl script gentree.pl is located.

2) The gentree.pl script reads the input GED file and five model HTML files and produces the output HTML and key data files. The file and directory structure can be anything that is convenient and can be changed by using parameters passed to the gentree.pl script. The cgi-bin directory must eventually reside in the same directory where the HTML and key data files are located on the web server. The list below is the way the files are organized for this example. To see what the files look like, click on the filenames. Note that to see the "raw" .html files, use the display page source option in your browser after opening the file.

gentree.pl = Perl script that generates the family tree HTML and key data files
mydemo.ged = Input GED file
modeldir/indmodel.html = Input individual page model HTML file
modeldir/fammodel.html = Input family page model HTML file
modeldir/idxmodel.html = Input index page model HTML file
modeldir/idxcemmodel.html = Input cemetery index page model HTML file
modeldir/idxidsmodel.html = Input ids index page model HTML file
htmldir/IND@Innn@.html = Output individual page HTML files
htmldir/FAM@Fnnn@.html = Output family page HTML files
htmldir/FAM@Gnnn@.html = Output generated family page HTML files
htmldir/IDXRIN.html = Output RIN (Resource Identification Number) index HTML file
htmldir/IDXSurname.html = Output Surname alphabetical order index HTML file
htmldir/IDXGiven.html = Output Given name alphabetcial order index HTML file
htmldir/IDXBdate.html = Output Birthdate order index HTML file
htmldir/IDXBplace.html = Output Birthplace order index HTML file
htmldir/IDXCemetery.html = Output Cemetery index HTML file
htmldir/IDXIDs.html = Output IDs index HTML file
htmldir/indfile = Output individual key data file
htmldir/namfile = Output name key data file
htmldir/famfile = Output family key data file
gentree.places = Output places file for KML generation scripts
####### Other files used by the family tree system:
htmldir/indstyle.css = Individual page cascading style sheet file
htmldir/famstyle.css = Family page cascading style sheet file
htmldir/idxstyle.css = Index page cascading style sheet file
htmldir/idxcemstyle.css = Cemetery Index page cascading style sheet file
htmldir/idxidsstyle.css = IDs Index page cascading style sheet file
htmldir/demohelp.html = Initial family tree help page
htmldir/cgi-bin/genanc.cgi = Perl CGI script that generates the Ancestor HTML page
htmldir/cgi-bin/ancmodel.html = Input ancestor page model HTML file
htmldir/cgi-bin/ancstyle.css = Ancestor page cascading style sheet file
htmldir/cgi-bin/gendesc.cgi = Perl CGI script that generates the Descendants HTML page
htmldir/cgi-bin/desmodel.html = Input descendants page model HTML file
htmldir/cgi-bin/desstyle.css = Descendants page cascading style sheet file
htmldir/cgi-bin/genrel.cgi = Perl CGI script that generates the Relatives HTML page
htmldir/cgi-bin/relmodel.html = Input relatives page model HTML file
htmldir/cgi-bin/relstyle.css = Relatives page cascading style sheet file
htmldir/helpfam.html = Help for family page HTML file
htmldir/helpfamsample.html = Help sample family page HTML file
htmldir/helpind.html = Help for individual page HTML file
htmldir/helpindsample.html = Help sample individual page HTML file
htmldir/helpidx.html = Help for index page HTML file
htmldir/helpidxsample.html = Help sample index page HTML file
htmldir/helpidxcem.html = Help for cemetery index page HTML file
htmldir/helpidxcemsample.html = Help sample cemetery index page HTML file
htmldir/helpidxids.html = Help for ids index page HTML file
htmldir/helpidxidssample.html = Help sample ids index page HTML file

The three key data files are read by the genanc.cgi, gendesc.cgi and genrel.cgi Perl CGI scripts and are used to produce the Ancestor, Decendants and Relatives HTML pages. There are eight cascading style sheet files that correspond to and are referenced by the eight model HTML files. There are two subsets of family HTML files. This family tree system needs a family HTML file for each individual, but the Legacy Family Tree GED file only has a family entry for individuals that have a spouse. The gentree.pl script generates a placeholder family entry for those individuals that do not have a spouse. Note that the current version of gentree.pl only handles a subset of all the possible GED file entries. Unhandled entries can be ignored/bypassed by specifying the -test flag when running the gentree.pl script.

$ ./gentree.pl -help
Usage: ./gentree.pl [-help] [-test] [-nogen] [-d "debuglevel"] [-ged "gedfile"] [-mod "modeldir"] [-html "htmldir"] [-del "surname"]
-help = Display this help information
-test = Ignore incomplete or inconsistent or unhandled GED file errors
-nogen = Suppress creating output files in the HTML directory
-d "debuglevel" = Enable printout for various debug levels
-ged "gedfile" = Use "gedfile" as the input GED file (default: gedfile.ged)
-mod "modeldir" = Use "modeldir" as the directory where to find the input model files (default: modeldir)
-html "htmldir" = Write the HTML output files into the "htmldir" directory (default: htmldir)
-del "surname" = Delete any individuals with "surname" from the output files

$ ./gentree.pl -ged mydemo.ged -mod modeldir -html htmldir
gedfile: mydemo.ged
modeldir: modeldir
htmldir: htmldir
Reading mydemo.ged ...
Generating IND HTML files ...
Generating FAM HTML files ...
Generating Index HTML files ...
Generating key data files ...
Done

3) The gentree.pl Perl script is organized as follows:
The main section reads the GED input file, analyzes the records, and populates associative arrays with the individual and family data. The following subroutines are called:
Processlev0() - Processes each level 0 GED file entry after all its subordinate levels are processed. For individuals, it composes the fullnames, indices for the surname and the given names, adds birth-death date ranges to the names, resolves all notes that are referenced by a key instead of text, sets up the pop-up windows for various addresses and notes, composes all the events associated with a person, and calculates the person's age for various facts and events. For families, it calls the Genfam() subroutine to generate a family record for all individuals that do not have one, and resolves the names for all the children in the family.
Checkinds() - Checks all individuals and determines their preferred family if they have more than one.
Processfams() - For each family, sets the fullname, birth, christening, death and burial data for the husband and wife, builds the tables for the spouse drop-down menus, gets the names for the parents of the husband and wife, and calls the Addstepchildren() subroutine to add the step-children to the family.
Genhtmlfiles() - Reads the input model HTML files for individuals and families, adds the variable data from the associative arrays, and creates the output HTML files. It then sorts the indices and creates the index HTML files.
Genkeydatafiles() - Creates the indfile, famfile and namfile key data files that are used by the genanc.cgi, gendesc.cgi and genrel.cgi scripts to recreate the associative arrays that are used by those CGI scripts.

4) Copy the ouput files and other data files, above, to the web server directories. For CGI scripts, be sure that none of them have CR/LF, only LF at the end of each line. Also be sure that the file permissions are correct (rwx,rx,rx or 755) on the web server, and that the page header information is correct. CGI scripts can be tested by running them outside the web server environment and specifying input parameters on the command line. If necessary you may need to comment out the two "use CGI" lines if your Perl does not have these modules.

5) The genanc.cgi Perl script reads the key data files to create its associative arrays, then reads its corresponding input HTML model file, adds the variable data from the associative arrays, and outputs the Ancestor page HTML data to the web server.

6) The gendesc.cgi Perl script reads the key data files to create its associative arrays, then reads its corresponding input HTML model file, adds the variable data from the associative arrays, and outputs the Descendants page HTML data to the web server.

7) The genrel.cgi Perl script reads the key data files to create its associative arrays, then reads its corresponding input HTML model file, adds the variable data from the associative arrays, and outputs the Relatives page HTML data to the web server.

Click here (or on the ENTER DEMO HERE button at the top) to transfer to the Demo Family Tree

###########################################################################################

8) There are four scripts that are used to generate KML files from the family tree for importing into the Google Earth display.
To see what the files look like, click on the filenames.

kmldoit.sh = Main Unix shell script that prompts for specific family tree input and creates the KML file
kmlruncgi.sh = Underlying Unix shell script called by kmldoit.sh that runs a CGI script
kmldoit2.sh = Underlying Unix shell script that correlates family tree places to latitude/longitude
kmlgen.pl = Underlying Perl script that generates the KML file
gentree.places = Input master places file generated by the gentree.pl script
htmldir/indfile = Input individual key data file generated by the gentree.pl script
htmldir/namfile = Input name key data file generated by the gentree.pl script
htmldir/famfile = Input family key data file generated by the gentree.pl script
uslatlong.txt = Input file containing United States latitude/longitude data
mylatlong.txt = Input file containing additional latitude/longitude data
modeldir/kmlmodel.kml = Input model KML file
kmldoit.places = Output intermediate places file generated by the kmldoit.sh script
kmldoit.work = Output intermediate work file generated by the kmldoit2.sh script
kmldoit.kml = Output KML file generated by the kmlgen.pl script

First download the GED file for the family tree to your computer. Instructions for doing this are in the introduction/help page for the family tree.
Then run the gentree.pl script (see above) to generate the gentree.places file for use by the following script.

$ ./kmldoit.sh
Enter name search:
Asa
@I1@ @F40@ blue Asa Clark Brown (1792-1866)
@I24@ @F46@ blue Asa Danial Brown (1838-1908)
@I101@ @F5@ blue Asa Clark (1742-1774)
3 keys found for "Asa"
Enter key for desired user:
@I1@
Processing key: @I1@
Enter ancestors (a), descendants (d) or relatives (r):
a
Enter records to search (birth,christening,death,buried,event,married,mevent,all):
a
type=ALL
Found 36 places
Places file is kmldoit.places
Checking file: kmldoit.places
36 places found
0 places not found
File kmldoit.work has 36 entries
Pin color YELLOW has 1 pins
Pin color GREEN has 10 pins
Pin color BLUE has 3 pins
Pin color ORANGE has 1 pins
Pin color DEFAULT has 3 pins
Pin color RED has 0 pins
Output file kmldoit.kml has 18 Placemark entries
Done

The KML file then can be imported to Google Earth https://earth.google.com to view the placemarks on the map of the Earth.

The information for file uslatlong.txt can be found on the Internet and has format:
latitude longitude #city,county,state,country

For entries not in uslatlong.txt manually create file mylatlong.txt with format:
latitude longitude #city,county,state,country

The gentree.pl script creates the gentree.places master file. It has an individual entry for each place mentioned in the family tree.

The .places files have this format:
(key of individual) (place type) (event type) (date) :#city,county,state,country
(place type) is one of these values: 1BIRT, 2CHR, 6DEAT, 7BURI, 3EVEN, 4MARR, 5MAEV

Script kmldoit.sh prompts for one individual and place type and then creates a specific kmldoit.places file for that person.
Underlying script kmlruncgi.sh is called by kmldoit.sh and runs one of the three CGI scripts (genanc.cgi, gendesc.cgi or genrel.cgi).
Script kmldoit2.sh compares kmldoit.places file locations to those in mylatlong.txt and uslatlong.txt files, and creates a kmldoit.work file.
Script kmlgen.pl reads the kmldoit.work file and creates a kmldoit.kml file for import to Google Earth.