getVarInt("pgid",1); // make sure not past ends if ( $pgid<1 ) {$pgid = 1; } if ( $pgid>755 ) {$pgid = 755; } //set previous page if ( $pgid>1 ) { $prev = $pgid - 1; } else { $prev = 1; } // set next page if ( $pgid<755 ) { $next=$pgid + 1; } else { $next = 755; } // get name of book or collection if any (such as RamseysAnnals) // $book = $_GET[book]; // Note: having this in the querystring is mostly for SEO $book = $req->getVarString("book",30,"RamseysAnnals"); $bookdisp = $book; if ($book=="RamseysAnnals") { $bookdisp = "Ramsey's Annals of Tennessee to the End of the Eighteenth Century (1853)"; } // get bookid (integer) for RamseysAnnals (tbd: generalize) $bookid = 3; // get name of location = folder holding current page // = 0 for pages up through 99, 1 for pages 100-199, etc. // calculate this numeric value for // RamseysAnnals = pageID with last two digits removed: $pgbin = (int) ($pgid/100); if ($pgid<100) { $loc="0"; } else { $loc = strval($pgbin); } // build path to file from book and location $path = "books/"; if ($book!="") {$path = $path . $book . "/";} if ($loc!="") {$path = $path . $loc . "/";} // build name of text file if any $txtn = $path . "txt/".$pgid.".txt"; $txtnexists = file_exists($txtn); // build name of annotations file if any $notesn = $path . "notes/".$pgid.".txt"; // build name of links file if any $linksn = $path . "links/".$pgid.".txt"; $sql = "SELECT * FROM pages INNER JOIN chapters ON (pages.intChID = chapters.intChID) WHERE (pages.intPgID=" . $pgid . ") AND (pages.intBookID=3) AND (chapters.intBookID=3) LIMIT 1"; // get data from database $conn = mysql_connect ("localhost", "roanetnh_spadmin", "aO4XpJv9FK"); // assume mysql is working $has_mysql = 1; if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); // mysql not working, save that fact in variable $has_mysql = 0; } if ($has_mysql==1) { if (!mysql_select_db("roanetnh_coll")) { echo "Unable to select database roanetnh_coll: " . mysql_error(); // mysql not working, save that fact in variable $has_mysql = 0; } } if ($has_mysql==1) { $result = mysql_query($sql,$conn); if ($myrow = mysql_fetch_array($result)) { // a row for this pgid was found! get fields.... $k = $myrow["strKeywords"]; $t = $myrow["strHTMLTitle"]; $chtitle = $myrow["strChTitle"]; $chsubt = $myrow["strChSubT"]; if (strlen($chsubt)==0) { $chfulltitle = $chtitle; } else { $chfulltitle = $chtitle . ": " . $chsubt; } $pgnum = $myrow["strPgNum"]; if (strlen($pgnum)==0) { $pgdisp = ""; } else { $pgdisp = " - Page " . $pgnum; } if (strlen($t)>0) { $t = $t . $pgdisp . ", " . $bookdisp; } else { $t = $chfulltitle . $pgdisp . ", " . $bookdisp; } } else { // echo "Sorry, no record for page " . $pgid . " found!"; } mysql_close($conn); } else { // here $has_mysql is not 1, that is, something is wrong with the mysql for some reason, so we must recover gracefully $k = ""; $t = ""; $pgnum = ""; $pgdisp = ""; $chtitle = ""; $chsubt = ""; $chfulltitle = ""; } if ($t=="") { // degrade title gracefully if no db record, hence no title $pgnumbyhand = $pgid-9; $pgdispbyhand = ""; if ($pgid>238) { $pgnumbyhand = $pgid-11; } if ($pgnumbyhand>0) { $pgdispbyhand = $pgnumbyhand . " - "; } $t = "page " . $pgdispbyhand . $bookdisp; } ?> <? echo $t; ?>



Notes Added for this Online Edition:


1) if (($pgid>1) || (file_exists($linksn))) { ?>

Other links about this page of Ramsey's Annals of Tennessee:

    1) { // calculate google books bookmark if ($pgid<10) { // front matter $googlepgid = $pgid-1; $googlebookmark = "PR" . $googlepgid; } else if ($pgid<248) { // before p238 map and following blank page $googlepgid = $pgid-9; $googlebookmark = "PA" . $googlepgid; } else if ($pgid<250) { // pgid=238 or 239, = p238 map or blank after map $googlepgid = $pgid-247; $googlebookmark = "PPA238-IA" . $googlepgid; } else { // pgid>=250, = after p238 map and following blank page $googlepgid = $pgid-11; $googlebookmark = "PA" . $googlepgid; } ?>
  • scan of this page in Google Books (opens in new window)