Question:
Web Design: How to insert HTML (like a header/footer) into a file?
patsup
2005-12-14 09:27:26 UTC
I'm trying to design a website that has similar (the same) header/footer for each file...

How can I simply "include" it without typing it in manually?

I can't use ASP/PHP/etc... Can I "preprocess" it locally (running windows XP) and then upload the files?

How? (free resources/programs appreciated)
Four answers:
kc0lkv
2005-12-14 10:36:23 UTC
I'm curios to know why you can't use PHP or MYsql.



Anyway... You could create a template page the way you like..you heaader and footer there. Then just simply add the content you want for each new page and save it with a different name.



But if you woul like to experiment with something really fun try Mambo...No its not a joke but a new way (well not so new) to design web sites.

You can install all the software need on your computer and all the software need it its free!



WITH MAMBO ISTALLED LOCALLY ON YOURHARD DRIVE YOU CAN DO ALL THE TESTING YOU NEED LOCALLY.



HERE A REALY GOOD HOSTING PROVVIDER FOR MAMBO WEB SITES. THEY WILL INSTALL MAMBO FOR YOU AND ALL YOU NEED TO CREATE YOU SITE OR LOAD YOU SQL DATABASE FROM YOUR LOCAL HARD DRIVE DIRECTORY.



www.siteground.com
Web Maven
2005-12-14 18:28:55 UTC
I agree with justwondering that SSI (Server Side Includes) is the best way to do what you're asking, at least on an Apache server. If it's a Windows server, you would have to use ASP. But you say you cannot use either ASP or SSI.



It is possible to use client-side logic, such as JavaScript. This wouldn't be as clean as server-side logic, because it will not work for everyone: some (perhaps 10-20%) of your visitors will have scripting disabled. Many people do use JavaScript for site navigation, and sometimes for common headers and footers. If for some reason you were sure that all, or nearly all, of your site's visitors would be sure to have scripting turned on, then this might be the way to go.
2005-12-14 17:32:30 UTC
I know you said you can't use a scripting language like PHP but that would be the preferred method. It would be incredibly simple to do with PHP. And the advantage would be that if you wanted to change all of the headers/footers at once you could just change one .inc (include) file.



HTML is a static language. It doesn't have a server-side component. As far as I know, you must use a dynamic scripting language to accomplish this. The only thing you can do is to specify the format of the header and footer (not the actual content) with CSS.
justwondering
2005-12-14 17:40:21 UTC
If your webhost allows SSI (Server Side Includes), you can create a file with the text, photo, html, etc. that you want to have on each page. Upload that page to the same directory that your root home page is in. Then, in each file, you can put an SSI 'Include' command to pull it in. Here's a website with a tutorial on SSI Include


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...