Page 1 of 1

include problem

Posted: Thu Jul 01, 2004 3:27 pm
by itsdavidp
I am trying to revamp my webpage so that the menu is loaded from another file, and therefore I do not have to rewrite the menu for every html file in my website.

Basically I tried copy and pasting my HTML menu out of the html file and into a new html file. I then used php and said:

Code: Select all

<?php 

include 'menu.html'; 

?>
However, it did not work properly.

I then tried moving everything in menu.html into menu.php, and I just made menu.php a series of print statements, so basically it would have the same effect as just displaying normal html code, and then change the include menu.html to be an include of menu.php, however, that did not work either.

The code can in its entirety can be viewed here:

http://students.cs.byu.edu/~dprucs/index.html
http://students.cs.byu.edu/~dprucs/menu.html
http://students.cs.byu.edu/~dprucs/menu.php

What do I seem to be doing wrong?

P.S. menu.html and menu.php both work correctly when used by themselves, however they do not work correctly when included in index.html

Posted: Thu Jul 01, 2004 3:39 pm
by feyd
are html files set to be parsed by php?

Posted: Thu Jul 01, 2004 4:05 pm
by d3ad1ysp0rk
For his first example, it wouldn't really matter. He just included it, so it should print everything to the screen.

Code: Select all

<?php include("filename.html"); ?>
try that (replacing filename with.. the filename :P )

Posted: Thu Jul 01, 2004 4:14 pm
by scorphus
Also, are you getting some error message? Post them here if you get any.

-- Scorphus

p.s. I tried to open http://students.cs.byu.edu/~dprucs/menu.html what returned an Error 404 page.