below is my code for index.php. it works fine when i have a series of 6 .php3 files that all have the $table variable plugged in manually (main.php3 for table 'main'), but i want to use the following code as just one file that uses the var $table.
#!/usr/local/bin/php
<?php
//extract varaible $table and $page from URL
$vars = substr($PATH_INFO, 1, -5);
$slash = "/";
$var_array = split($slash, $vars);
$table = $var_array[0];
$page= $var_array[1];
//mysql connect stuff
$db = mysql_connect("server", "user", "pass");
mysql_select_db("Database", $db);
//notice: this is where the $table content-variable lives (the 'main' in www.website.org/main/index.html). i'm using 6 tables to subdivide content
//this is also the first occurrence of the $page content-variable (the 'index' in www.website.org/main/index.html)
$result = mysql_query("SELECT * FROM $table where page=\"$page\"", $db);
//i'm using template.inc from PHPLIB with a single .ihtml file
include "templates/template.inc";
//set up all variables for use with template
$title = mysql_result($result,$page,"title");
$expires = mysql_result($result,$page,"expires");
$robots = mysql_result($result,$page,"robots");
$description = mysql_result($result,$page,"description");
$keywords = mysql_result($result,$page,"keywords");
$content = mysql_result($result,$page,"content");
$rollfile = 'includes/rollover.js';
$rp = fopen( $rollfile, 'r' );
$rollover = fread( $rp, filesize( $rollfile ) );
fclose( $rp );
$navfile = 'quicknav.js';
$np = fopen( $navfile, 'r' );
$quicknav = fread( $np, filesize( $navfile ) );
fclose( $np );
//do the template hole-plugging
// create a template object named $t
$t = new Template("templates/");
// set MyFileHandle = our template file
$t->set_file("website","website.ihtml");
// set template variable some_color = $my_color value
$t->set_var("page_title",$title);
$t->set_var("page_expires",$expires);
$t->set_var("page_robots",$robots);
$t->set_var("page_description",$description);
$t->set_var("page_keywords",$keywords);
$t->set_var("page_content",$content);
$t->set_var("roll_over",$rollover);
$t->set_var("quick_nav",$quicknav);
// set template variable MyOutput = parsed file
$t->parse("weboutput","website");
$t->p("weboutput");
?>
again, this all works just fine, and if i had it set up to use a simple URL like www.website.org/index.php3?table=main&page=index, it would run like a charm. i'm being stubborn though because i'd like to have my site be indexable by search engines that don't support ? or & in the URL.
the above code should work with www.website.org/main/index.html as URL, and i still think the solution may lie within the apache configuration somewhere.
thanks for your help,
-dolphinsnot