...

View Full Version : html file in to another html file



gopi44
12-03-2009, 03:03 PM
I have a problem in html. does any body know how to include the html file in another html file.

Crispy
12-03-2009, 03:33 PM
Can you explain in more detail what you're trying to achieve? :)

briansmccabe
12-03-2009, 03:34 PM
I'm actually glad to hear I'm not the only one. This was driving me CRAZY the other day. I used to do this all the time (that is, I used to use HTML's means of including files inside other files) and now I can't seem to do it. I wound up converting my pages to PHP just to be able to do includes.

The way I was trying to do it was like this:

<!--#include file="folder/filename.html"-->

And that would not work. I also tried replacing "file" with "virtual".

When I did this successfully at an old job, it was ASP pages being included inside other ASP pages, but it was using HTML to do the including, just like in the example above.

Good luck, and I will keep an eye on this thread. I hope you find an answer.

Apostropartheid
12-03-2009, 04:07 PM
I'm actually glad to hear I'm not the only one. This was driving me CRAZY the other day. I used to do this all the time (that is, I used to use HTML's means of including files inside other files) and now I can't seem to do it. I wound up converting my pages to PHP just to be able to do includes.

The way I was trying to do it was like this:

<!--#include file="folder/filename.html"-->

And that would not work. I also tried replacing "file" with "virtual".

When I did this successfully at an old job, it was ASP pages being included inside other ASP pages, but it was using HTML to do the including, just like in the example above.

Good luck, and I will keep an eye on this thread. I hope you find an answer.

Was the extension .shtml? The server needs this in order to process it.

weaver
12-03-2009, 04:33 PM
I added a couple of lines to my htaccess file to have my html files parsed as shtml. Since I have navigation (and footer) includes on all my pages, this brings them in without introducing the filename extension of shtml to my users. Here are the lines I use:

AddType text/html .html
AddHandler server-parsed .html

Be very careful when editing your htaccess file. You can throw your whole website into a tizzy if you goof up.

I usually copy my original over to a notepad while I am making changes so I can immediately copy it back in if I mess something up.

Then you can use your include statement in this format:

<!--#include file="folder/filename.html"-->

Weaver

gopi44
12-04-2009, 02:52 PM
Thanks for giveing quick reply. :)

I tried that but its not working in html.

if I use the PHP it will work?

Apostropartheid
12-04-2009, 04:40 PM
If you chance your file extension to .php and use PHP code (the include() or require() function) then yes, it'll work.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum