>I'm trying to do a little trick with my new site. i have one main php >script, index.php which includes the header and footer scripts and the >page script between them. the page script is determined by $page, which >is set to "main" if it doesnt exist already. $page . ".php" is then >included. I have one other page so far, "datetime.php". I wanted to >let datatime run itself by including the headers and footers on its own >if it wasnt included by index.php. so, i add this to the top and >similar code at the bottom (replaced header with footer): > ><? > if (!$page=="datetime") // Not using index.php > { > include("header.php"); > } >?>
The !$page probably happens before the ==, so you are testing !$page (true or false) being equal to "datetime"... You may or may not want to use something more like: <?php if (!strstr($PHP_SELF, 'datetime')){ include 'header.php'; } ?> I personally, though, would have *three* files. One, datetime.inc would do the work. index.htm would include 'datetime.inc' datetime.htm would also include 'datetime.inc' I think this will be less confusing to you a year later when you have to maintain this code. -- Like Music? http://l-i-e.com/artists.htm Off-Topic: What is the moral equivalent of 'cat' in Windows? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php