Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

including header and footer

Status
Not open for further replies.

vero66

Programmer
May 16, 2005
5
GB
Hi,

is it possible to call header.html and footer.html from my index.html page in html only?

thanks
v
 
Not in HTML, no. HTML has no way of including files.

Your web server may support server-sice includes (in .shtml files), but other than that, you'd need to use a server-side scripting language (ASP, PHP, etc).

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
SSI is very common - it would be unusual for a hosting service NOT to provide it, so given that, here's how to do it:
Code:
<!--#include virtual='/lib/header.shtml'-->
<!-- Content starts here -->
.
.
.
<!-- Content ends here -->
<!--#include virtual='/lib/footer.shtml'-->

The .SHTML extension tells the server that there is SSI in the file that needs to be processed. THe HTML that is sent to the browser does not have any SSI directives in it - they are processed at the server.



Mike Krausnick
Dublin, California
 
Thank you all for your help,

Im building my website for my own (non IT) start up company and Im only using html as I don't have a server at home, the host company says: CGI Script enabled, so i guess i could use shtml but i can't check until my site is finished?

will have a look at CSS2 too..

thanks
v
 
There's more on SSI in faq253-3309 and faq253-2000 . Use them if you can, it's a very powerful tool.

Just to correct/clarify what Mike said, the HTML file that has the include statements in it is the one that needs to have the [tt].shtml[/tt] extension (on a default server set-up). The files that are included can have any extension you like.


-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top