Including Headers and Footers
I wasn't sure whether or no to post this here or in the server-side scripting forum but here goes: Basically, I just want to have a separate file for my web page's header and footer, so that I can update one and it will update on all pages that use the header/footer. I thought SSI might have been the easiest way to do this but I must be doing it wrong. Here is the code I was using:
<!-- #include virtual="header.shtml" -->
Is this incorrect? Or is there another way it could be done? I'd prefer to stick to XHTML and CSS for now but I don't mind putting a little PHP (or what ever is needed) in there.
Thanks.
Suzanne posted this at 23:31 — 3rd July 2004.
She has: 5,507 posts
Joined: Feb 2000
No space.
Also, check alistapart.com for articles on for perhaps another option.
Colin Barnette posted this at 01:03 — 4th July 2004.
They have: 9 posts
Joined: Jul 2004
Doh! Darn syntax! Thanks.
Colin Barnette posted this at 01:23 — 4th July 2004.
They have: 9 posts
Joined: Jul 2004
Edit: Nevermind me. The whole of the problem was that I didn't understand SSI to begin with. I thought that the webserver searched the document for SSI directives regardless of filetype, and would only load .shtml files. I didn't know you couldn't use SSI directives in .html. Doh.
Suzanne posted this at 03:14 — 4th July 2004.
She has: 5,507 posts
Joined: Feb 2000
Heh, yeah, any server-side trickery requires the pages be parsed on the server -- and the extension identifies how to do it (usually).
http://www.alistapart.com/articles/dynanav/
Roo posted this at 05:19 — 4th July 2004.
She has: 840 posts
Joined: Apr 1999
Link.........vewwwwwwy intewesting! I saw the link to that article on Zeldman's site but hadn't read it yet.
I wonder what the pros and cons of would be between using includes or this. I think I read that it's more taxing on the server to need to parse things using SSI, though not too much?
Roo
Suzanne posted this at 22:11 — 4th July 2004.
She has: 5,507 posts
Joined: Feb 2000
I don't think it's as big an issue now -- in yesteryear, there was a real concern about CPU usage. You can still overload the server, but mainly it's an issue for big sites now.
Server-side includes allow you a lot more freedom and reliability, since they don't depend on browser support.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.