开发者

how to include a html page with in another html page

开发者 https://www.devze.com 2023-01-01 06:09 出处:网络
Hai I want to include an html page with in another html page. So I used the following code <!--#include file=\"footer.html\" -->

Hai

I want to include an html page with in another html page. So I used the following code

<!--#include file="footer.html" -->

But it's not working. I am using Linux server. Is there is any other way to开发者_Python百科 do this?


To use that syntax you must enable SSI and configure your server to process your files for it (by default, if SSI is turned on, most servers will only look for SSI directives in files ending in .shtml).

If you want to do this in HTML, then your only real option is frames, which have lots of drawbacks.

You may be better off using a template language. I like Template-Toolkit which you can use on the server (with Perl) or run offline (e.g. with the ttree utility).


Linux is case sensetive ;). File should be in the same directory as the file from which you are calling it at the moment. And watch cases. If the file is called Footer.HTML or FoOter.html it won't open.


Depending on how your server is set up you would need to confirm if you have enabled Sever Side Includes.

Here is an article that would assist you further. http://www.linuxtopia.org/HowToGuides/apache_ssi.html

Another way of doing it would be to use a server side language such as PHP

Regards

0

精彩评论

暂无评论...
验证码 换一张
取 消