PDA

View Full Version : php4 headers and footers



Haze
July 20th, 2001, 01:40
I have no idea what im doing when it comes to php, but what I want to do is to be able to include a header and footer that are seperate php files. Anyone know how this is done?

I tryed doing this but it doesnt work. Am I wrong or what?

<?PHP
require ('/header.html');
?>

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="700">
<tr>
<td>asdfasdfasdf</td>
</tr>
</table>
</center>
</div>

<?PHP
require ('/footer.html');
?>

Beans
July 20th, 2001, 04:49
Try this:

<?PHP
require ("header.html");
?>

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="700">
<tr>
<td>asdfasdfasdf</td>
</tr>
</table>
</center>
</div>

<?PHP
require ("footer.html");
?>


Instead of single quotes... use double quotes to enclose your header and footer filename. And remove the "/" if it still doesn't work

lucifer
July 20th, 2001, 05:52
Originally posted by Beans
Instead of single quotes... use double quotes to enclose your header and footer filename. what is this the campaign against single quotes? ;)


evilhaze: 'it doesn't work' this is informative :p

Haze
July 20th, 2001, 18:30
Thanks beans, it worked!

gyrbo
July 22nd, 2001, 11:29
It's because php uses server based paths, not URL based ones (execpt if you use http://)