getVarInt("pgid",1); // make sure not past ends if ( $pgid<1 ) {$pgid = 1; } if ( $pgid>82 ) {$pgid = 82; } //set previous page if ( $pgid>1 ) { $prev = $pgid - 1; } else { $prev = 1; } // set next page if ( $pgid<82 ) { $next=$pgid + 1; } else { $next = 82; } // get language of this version (usually not present); Hariot's is in both the original and in "us" (US English) $lang = $req->getVarString("lang",5,""); if ($lang!="us") { $lang = ""; $txtdir = "txt"; $langquery = ""; $titlelang = ""; $brief = "riefe"; } else { $txtdir = "txt-us"; $langquery = "&lang=us"; $titlelang = "US English "; $brief = "rief"; } // get name of book or collection if any (such as Hariot-DeBry-Briefe-True-Report-Virginia) // $book = $_GET[book]; // Note: having this in the querystring is mostly for SEO $book = $req->getVarString("book",45,"Hariot-DeBry-Briefe-True-Report-Virginia"); $bookdisp = "A b" . $brief . " and true report of the new found land of Virginia... by Thomas Hariot (1588), published with illustrations by Theodore de Bry (1590)"; // get bookid (integer) for A briefe and true report (tbd: generalize) $bookid = 6; // 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 // Hariot-DeBry-Briefe-True-Report-Virginia = 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 . $txtdir . "/".$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=6) AND (chapters.intBookID=6) 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"]; $htmlt = $myrow["strHTMLTitle"]; if (strlen($htmlt)==0) { $htmltdisp = ""; } else { $htmltdisp = " - " . $htmlt; } $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 = ""; $pgdispleft = ""; } else { $pgdisp = " - Page " . $pgnum; $pgdispleft = "p. " . $pgnum . ", "; } if (strlen($t)>0) { $t = $pgdispleft . $t . ", " . $bookdisp; } else { $t = $pgdispleft . $chfulltitle . ", " . $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 = ""; $pgdispleft = ""; $htmltdisp = ""; $chtitle = ""; $chsubt = ""; $chfulltitle = ""; } if ($t=="") { // degrade tile gracefully if no db record, hence no title $pgnumbyhand = $pgid+1; $pgdispbyhand = ""; $appendix = ""; if ($pgid>32) { // appendix is numbered 1 - up = extra pages after main body of a briefe and true report $pgnumbyhand = $pgid - 32; $appendix = "A"; } if ($pgnumbyhand>0) { $pgdispbyhand = $appendix . $pgnumbyhand . " - "; } $t = "page " . $pgdispbyhand . $bookdisp; } ?> <? echo $titlelang . $t; ?>



Notes Added for this Online Edition:



Other links about this page: