Click to See Complete Forum and Search --> : Php, executing php in a file loaded with php.


Gogeta_44
10-23-2004, 02:31 AM
I'm using a dynamic navbar setup for a site i'm designing. It loads a file in php into the current file with:
<?php
if (!($f=fopen("phpnavcode.php","r")))
exit("Unable to open NavBars.");
while (!feof($f))
{
$x=fgetc($f);
echo $x;
}
fclose($f);
?>
but then in the file it loads, it needs to execute some php code to detect what browser the user has. It won't b/c php works line by line so I need to get it to reread the php loaded from the file.
Thanks

Choozo
10-23-2004, 04:51 AM
PHP does not "work line by line", but executes all its code on the server side - then returns the result to the client (your browser).
You need to tell the server which browser/version that are requesting your pages, so PHP can serve the correct one(s). This could be done by some JavaScript and redirects in your index page.

Gogeta_44
10-23-2004, 12:12 PM
Well thats not exactly what i want to do. I made a program in php to detect if the user is running IE, and add an extra command to the body tag if its not. This needs to go inside the navbar file thats loaded into the curremt page. After its read and the source for the navbar is loaded in the page on the server, the file it loads isn't re-read for any php and isn't executed.