$ON_SERVER = 1; if ($ON_SERVER) { define ("FILE_ROOT", "/home/zbohy/sites/English"); } else { define ("FILE_ROOT", "C:/Inetpub/wwwroot"); } define ("SITE_PATH", FILE_ROOT."/Dharma/zbohy/chinese_text"); $TEXT_NAME["diamond"] = "Diamond Sutra"; $TEXT_NAME["hsinhsinming"] = "Faith in Mind"; $TEXT_NAME["platform"] = "Platform Sutra"; error_reporting(15); //require "read.phtml"; // create the menu here function readcsv($fp) { // this doesn't work in older php, fgetcsv($fp,1000, ","); // so this function is the longer way to do it $fline = fgets($fp, 256); if ($fline) { $arr = split (",",$fline); $arr_max = count($arr); for ($i = 0; $i<$arr_max; $i++) { $arr[$i] = trim ($arr[$i]); } return $arr; } else return 0; } if (!isset($_file_dir)) $_file_dir = "diamond"; if (!isset($_page_file)) $_page_file = "2"; $sutra_name = $TEXT_NAME[$_file_dir]; $file_dir = $_file_dir.'/'; $page_file = $_page_file; $datadir = "text/"; $datafile = "data.txt"; $menufile = "menu.inc"; // set up global $files = array(); $file_row = 0; // default to 0, not found $row=1; // row counter start at 1 if (!file_exists($file_dir.$datafile)) // create the data file process_dir($file_dir.$datadir, $menufile, $datafile ); $fp = fopen($file_dir.$datafile,"r"); while ($data = readcsv($fp,1000, ",")) { // read comma separated file $files[$row] = $data; // data is an array if ($files[$row][0]==$page_file) $file_row = $row;// check if html file match $row++; } fclose($fp); $maxrow = $row-1; $has_prev = 0; $has_next = 0; if ($file_row) {// greater than 0, we found it $filetitle = $files[$file_row][1]; // can't substitute 2d array in string //print "
";
include SITE_PATH."/meta/contentfooter.inc";
die();
include "common/tablefooter1.shtml";
print "
";
include "meta/links.shtml";
print "
";
include "meta/pfooter.shtml";
?>