如何在另一个html页面中包含html页面 [英] how to include a html page with in another html page

查看:390
本文介绍了如何在另一个html页面中包含html页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai

我想在另一个html页面中包含html页面。因此,我使用了以下代码:

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

但它不起作用。
我正在使用Linux服务器。有没有其他方法可以做到这一点?

解决方案

要使用该语法,您必须启用 SSI 并配置你的服务器为你处理你的文件(默认情况下,如果SSI打开,大多数服务器只会查找SSI指令文件以 .shtml )结尾。



如果你想在HTML中做到这一点,那么你唯一的选择是框架,其中有很多缺点



您使用模板语言可能会更好。我喜欢 Template-Toolkit ,您可以在服务器上使用(使用Perl)或脱机运行(例如使用 ttree实用程序)。

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 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).

这篇关于如何在另一个html页面中包含html页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆