Page 1 of 1

PHP file extension question: please help!

Posted: Mon Jul 22, 2002 2:13 pm
by catherine878
Hi all,

I want to include a navigation menu (navig.html) in every page of a site. For example, I used the following code in an ABOUT page:

<?php
$fp=fopen ('navig.html',"r");
$menu=fread ($fp, 30000);
fclose($fp);
echo $menu;
?>

And it works, but I must have the file ABOUT saved as a PHP file instead of a regular HTML page. Is there anyway I can keep the HTML extension but still display the content from navig.html using the above code?

Many thanks!!!

Catherine

Posted: Mon Jul 22, 2002 3:10 pm
by BDKR
Yes, just use an include() or require() function. It should work fine with an HTML extension on the end of the file.

However, I have a question. Are you using relative or absolute urls in the menu? How do you insure that the links are good from page to page?

Later on,
BDKR

But...

Posted: Mon Jul 22, 2002 3:53 pm
by catherine878
Require () works too, but if I save the file as HTML it still won't display anything... I don't know why.

Thanks !

Posted: Mon Jul 22, 2002 3:57 pm
by jason
Yes, you have to edit the httpd.conf file of the Apache server to add it in.

If you don't have access to the httpd.conf file, then you are pretty much stuck. But why does it have to be .html and not .php?