Forum Moderators: mack
Is there a simple and efficient way to make a chunk of code that is repeated in all the pages of my site be easily replaceable/modifiable, so I don't have to manually edit each page with the same thing? Is there some kind of "include" type statement in html that I didn't find in the references that would allow me to keep this piece of code in a single file and have all the others reference it? Would this even be recommended?
A little background on this question: the reason I'm asking this is that I'm making up a new website and have a consistent menu on the left and top. The best way I could come up with to do this without using frames was duplicating the menu in all the pages, however, I am still working on the menu as I go along, so each change has to be made in all the pages. Am I just going about this in the completely wrong way? Is there a better strategy to do non-frames menus that are in all pages? I'm coding this site pretty much by hand (using coffeecup html).
Thanks in advance! :)
Shenan
You can do includes with various types of server side languages such as PhP, ASP, and JSP.
You can also do them with .shtml files, but I think that has to be on a Windows server, though I may be wrong.
You can search here for SSI or Server Side Includes, which will give you tons of information on it.
And, yes, includes are THE way to go.
It is very possible to do what you are wishing by using includes.
A lot of sites acheive this using php pages. In these situations what you will find is they have a page called index.php This page will include header.php main.php and footer.php
The header and footer files are used on all pages, but there is only one instance of each file, so any changes you make will be displayed on all pages that call the files as includes.
What you can do is have a file with your text body on it. then include it into each of your pages.. that way if you need to change the text you only need to update one file.
Mack.
I did find some tutorials on how to do these header and footer includes. Couldn't be simpler.
Thanks again everyone! :)