how to *include* a file in an html page?

C

cooldv

i have many *.html* pages with the same header. i wanted to make one
*header* file and put a link to that file in all html pages. So if i
ever need to make changes in the header, i will need to edit only 1
file rather than all pages.

for *.asp* pages this code works fine:-

<!-- #include file="filename.inc" -->


but the same **include** does not work for *.html* pages. i guess
there is some other way to put a link!
any help appreciated
 
S

Steven Burn

You can use an iFrame, however, I would not reccomend it as it is a little
"cluttery" to say the least.

You'd be best off converting your pages to .ASP and using the #include tag.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
G

Guest

You need SSI (Server Side Includes) in some shape.
It depends in the server type (mainly Windows/IIS or Unix/Apache) as well as
on its settings.
You have to ask your ISP.
If they do not support ASP they might support shtml extentions which allow
SSI. The include syntax should be the same as in ASP, but you better check
it at, say
http://www.webcom.com/~webcom/help/inc/include.shtml

Alternatively, if you do noit want to change the files extention you can put
the headings into .js files and output then using Javascript

Yet the cleanest way is, as Steven suggested, switch to ASP (or to PHP if
you are in Apache)
 
J

Jeff Cochran

i have many *.html* pages with the same header. i wanted to make one
*header* file and put a link to that file in all html pages. So if i
ever need to make changes in the header, i will need to edit only 1
file rather than all pages.

for *.asp* pages this code works fine:-

<!-- #include file="filename.inc" -->


but the same **include** does not work for *.html* pages. i guess
there is some other way to put a link!

Okay, I may be stating the obvious, but of course ASP code won't work
in an HTML file. Either rename the HTML file with the ASP extension,
alter IIS to process all HTML extensions as ASP (App Mappings - Dumb
way to do it...), or use SSI and include the file in your HTML code.
You'll need to use a SHTM/SHTML extension to process SSI in IIS, so
you might as well rename the files with an ASP extension to begin
with.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top