Automatically adding header/footer to web pages [Archive] - SpeedGuide.net Broadband Community

View Full Version : Automatically adding header/footer to web pages


glc1
04-29-02, 04:05 PM
Rather than using frames or manually adding a header and footer to each page, how do I do so automatically? I assume I'd have to write some sort of script (I have no programing experience, other than HTML) and parse the pages through it?

Thanks in advance...

master7
04-29-02, 04:13 PM
Use PHP and insert this

Header:

<?php
include 'top.php';
?>

footer:

<?php
include 'bottom.php';
?>

and then make the files top.php and bottom.php and include whatever you want in them.
Then rename the file you edited to a .php file

Or you can use SSI

<!--include virtual="/path/to/file.txt"-->

then rename the file to .shtml or .shtm

glc1
04-29-02, 07:38 PM
Thanks for the reply, master7.

PHP doesn't work for me (the two commands are competely ignored). SSI does, however, only if I "preview" the page via the HTML editor I'm using (Dreamweaver 4).

TonyT
04-29-02, 08:27 PM
PHP doesn't work for me (the two commands are competely ignored).

Correct. To view teh php in action you need to have a server installed locally with php version also installed or view the pages online at a host with php installed.

glc1
04-29-02, 08:42 PM
Originally posted by TonyT


or view the pages online at a host with php installed. Did that. Nothing loads. Just a blank page.

glc1
04-29-02, 08:51 PM
Originally posted by glc1
Did that. Nothing loads. Just a blank page. Scratch that, just got PHP working. Thanks guys.