jAC Family History

Page home demo

Welcome to my little world.

This site is a demonstration of utilizing my little library to create and use family tree geneoligical data. This is a fun little toy, and not to be thought of as a comprehesive solution! The site you are looking at is just some quick and dirty HTML/PHP wrapped around the tree library.

I am interested in preserving some family history and geneolical information. But not really that interested to go all in and do research and learn to use professional documentation, vocabulary, and scripts. My goal is to have some minimal information collected and preserved without much effort. My data collection may provide a foundation some day for a younger family member who actually is interested in constructing a geneological history of the family.

This little app gives me a quick and dirty way of preserving the geneological info in one simple accessible text file.

I use the tree library and a Markdown based CMS du jour to maintain a little family site that keeps the stories, photos, and documents we want to preserve. My family contributes their memories by emailing data to me. I update the data file and markdown files. That site can be password protected if family objects to being out there in the internet. But mostly I just use it on my localhost.

The demonstration site you are looking at now is not a CMS. This is just an index.php file for routing and loading a single layout for the requested page.

The System

Consists of one data file and one PHP Library. 1. Data File : The YAML Based Text file that basically has 2 categories. The Fake Sample Data is on this site at Data Menu. There are 12 families and 40 people represented in that file. You can come up with some strategies to use multiple datafiles for different branches of the family. - People : Every person to be listed in the history. - Families : Groupings of People with their relationships. - Parent-Child - Spouse-Spouse - Familyhead 2. PHP Object to read that one YAML file and create accesible php arrays and objects you can use in your own php scripts. Your ideas may not be limited by just lists and charts. - php code The Php Code creates user accessible arrays of the data in various formats and filters. - php/html layout files These layouts for the List and Charts and Events use recursive php functions to build the html output. Each layout include some fancy (and not understood by me CSS). That code is included in the LAYOUTS provided in the script. You can modify and copy those layouts as you please.

You can learn more in the Readme file.

Sample Use - Events

This Layout produces the events list. This is a very basic Layout using the library. See a little fancier on the top menu.

// ---------------------  example EVENTS template ---------------------
require 'lib/jacfamilyhistory-ext-standalone.php';  
$jactree = new jacfamilyhistory();
$startmonth = 1; $nummonths=12; $family='top';
$myevents = $jactree->getFamilyEvents($startmonth, $nummonths, $family );
// -- you develop your templates -------------------------------
$out = '';
for($m=1; $m<=12; ++$m): 
    $month = str_pad($m,2,"0",STR_PAD_LEFT);
    $monthname = date('F', mktime(0, 0, 0, $month, 1));
    $out .= "<p>$monthname</p>\n";
    $out .= "<ul>\n";
    foreach($myevents[$month] as $day => $list): 
        foreach($list as $key2 => $event): 
                // getFamilyEvents does not return all fields for a person, just a name and key
                // when needed you can get all fields for the person by key
                // $personarray = $jactree->getPerson($event['person']);
                // get all the family parents, persons siblings, and every thing below this family recursivelt
                // $familyarray = $jactree->getFamily($personarray['familyID');
                // Here just demonstration printing   ( familyID :: personID )
                $familycode = $jactree->getFamilycode($event['person']);
                $eventText =  $event['date'] . ' :: '.$event['type'].' :: '.$event['description'].' ( ' .$familycode.' :: '. $event['person'].' ) ' ;   
                $out .= "<li>$eventText</li>\n";
        endforeach;
    endforeach;
    $out .= "</ul>\n";
endfor;
echo $out;
// ---------------------  end example template ---------------------
Produces

...
...

February
1900-02-22 :: Birthday :: Aunt Mary - 1900 ( itgm :: auntmary )
1900-02-22 :: Birthday :: Uncle Joe - 1900 ( itgm :: unclejoe )
1900-02-22 :: Birthday :: Gmom - 1900 ( gpop :: gmom )
2020-02-22 :: Died :: HJomer - 2020 ( homer :: homer )

March
2023-03-10 :: Birthday :: Sawyer - 2023 ( kri :: sawyer )
2021-03-10 :: Birthday :: Slone - 2021 ( kri :: slone )
2021-03-10 :: Birthday :: Justini - 2021 ( kri :: justini )
1960-03-12 :: Birthday :: Bart - 1960 ( bart :: bart )

April
1920-04-04 :: Married :: Gmom-Boilers & Gpop-Boilers - 1920 ( gmom-boilers :: gmom-boilers )
1930-04-06 :: Birthday :: HJomer - 1930 ( homer :: homer )
1993-04-07 :: Birthday :: Patty - 1993 ( lisa :: patty )
1926-04-13 :: Birthday :: Mickey - 1926 ( friends :: mickey )
1954-04-19 :: Birthday :: Clancy - 1954 ( lisa :: clancy )

May

...
...

Sample Use - Family Nested List

This Layout produces the Families list. This is a very basic layout using the library. See a little fancier on the top menu.

I don't fully understand recursion, and don't know how to seperate the layout from the recursion, but it works.

// ---------------------  example FAMILY LIST template ---------------------
// --------------------------------------------------------------------
// RECURSIVE TEMPLATE LIST NAVIGATION
// build the multilevel HTML for the LIST OF FAMILIES
function myfuncSimpleList($arr=[]) {
  global $jactree;  // Set in main index file.......
  $nav='<ul>';
  foreach($arr as $key => $val) {
    $val['DisplayText'] = $val['fullname'] ;
    // accurate enough for these purposes.......
    $age = intval(substr(date('Ymd') - date('Ymd', strtotime($val['birth'])), 0, -4));
    if(!isset($val['familytop'])){
     $isFamilyHead = false; 
        // then they are not a designted family primary parent1 
        // no recursion necessery, print it and move on to next name in list...
      $tagline = '... still ain\'t hitched yet.';
      if($age < 20) $tagline = 'is still just a wee tyke...';
      $nav .= '<li>';
        $nav .= "{$val['DisplayText']}  $tagline";
      $nav .= '</li>';
    }
    // Is a familytop/FamilyHead, so will have family privledges create a family title for display 
    if( isset($val['familytop'])){
        $isFamilyHead = true;
        if(!isset($val['spouse'])){ 
        // family with one parent or head of house
                $val['spouse'] = '';
                $marriageref = '';
                $val['DisplayText'] = $val['fullname'];
        } else {
        // family with two parent
                $spouse = $jactree->getPerson($val['spouse']);
                $val['spouse'] = $spouse['fullname']; 
                $marriagedateTS = strtotime($val['marriage']);
                $marriageref = date('Y', $marriagedateTS) ;
        }
        $val['DisplayText'] = ''.$val['fullname'].' and '.$val['spouse'] . ' tied the knot in '.$marriageref; 
    }           
    // print the Displaytext for the person.
    // if they got children recursively go down and see if the kids be married with kids too.....
    if ( ($val["children"] && count($val["children"]) > 0) || $isFamilyHead) {
      $nav .= '<li>';
          $nav .= "{$val['DisplayText']}"; 
          foreach($val["children"] as $item) {
            // ---- RECURSIVE happens here if children ------------
            // ---- CRITICAL if you change the name of the function to create a new template  
            // -------- YOU MYST REMEMBER TO CHANGE THE NAME IN THE LINE BELOW TOO!!!
            $nav .= myfuncSimpleList($item);
          }
      $nav .= '</li>';
    } 
  }
  $nav .= '</ul>';
  return $nav;
}
// ------------TEMPLATE EXECUTION and CREATION STARTS HERE ---------------------------
$family = 'lisa';
$treedata = $jactree->getFamilyList($family);
//local RECURSIVE function in this template above to format a nested UL LIST.
//To modify the output, you modify the function above!!!
echo "\n".'<div class="NEWfamilylist">'."\n";
echo myfuncSimpleList($treedata);
echo "\n".'</div>'."\n";

// ---------------------  end example template ---------------------
Produces
Lisa Jon Simpson and Clancy Serf Bouvier tied the knot in 1983
    Kri Bouvier and Billy Justini tied the knot in 2019
        Sawyer Kri Justini is still just a wee tyke...
        Slone Kri Justini is still just a wee tyke...
    Patty Kti Bouvier ... still ain't hitched yet.
    Selma Ksi Bouvier ... still ain't hitched yet.

TOP

System Information Page: /history/page-home-demo
Filename: content/history/page-home-demo.md
ParentFolder: page-home-demo
Parent: history/page-home-demo
ParentTop: history
Theme: w3css
Layout: default
LayoutLocation: ../yellow/system/layouts/w3css/
SystemLocation: ../yellow/system/
SystemPath: /home/jacmgr/jhinline.com/sites/yellow/system/

You can select from these default themes:
berlin | karlskrona | paris | wittstock | stockholm | philly | phillysidebar | seoul | jaccopenhagen-orange | jaccopenhagen-blue | copenhagen | sunya | clarity | delta | w3css | morton | |