避免重复标题和标题页脚

发布于 2024-11-13 11:04:49 字数 201 浏览 3 评论 0原文

我正在构建一个至少有 7 个页面的网站,并且正在寻找一种方法来避免重复所有标题和内容。每个 html 文档上的页脚等。

我知道有框架和 iframe,但有些浏览器不支持这些,我想做一些更高效、更灵活的更新。有什么想法/建议吗?


感谢各位提供的信息!我一定会尝试一下。 另一件事是我的标题中有一个登录表单。这些方法会影响吗?

问候

I am building a website with at least 7 pages and am looking for a way to avoid having to repeat all headers & footers etc. on every single html document.

I know there are frames and iframes but some browsers don't support these and I want to do something more efficient and flexible for updates. Any ideas/suggestions?


Thanks for the information guys! I'll be sure to try them out.
One more thing is that I have a login form within my header. Will these methods affect it?

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

霞映澄塘 2024-11-20 11:04:49

是的,服务器端包含是可行的方法,只需一些说明:

1)如果您选择使用 PHP,则可以按照 Sotiris 的描述进行操作 - 这是非常常见的选择,顺便说一句,实际上所有主机都支持 php。

2)虽然该文件的扩展名为.php,但您可以将纯html代码放入其中。

3)为了能够在上传之前在您的计算机上进行测试和查看,您必须在计算机上安装服务器。在这一点上,我认为对您来说最简单、最快的是寻找一些现成的解决方案 - 这些可以免费下载:

http: //www.wampserver.com/en/(对于 Windows)

http://www .mamp.info/en/index.html(用于Mac)

http://tuxtweaks.com/ 2010/04/installing-lamp-on-ubuntu-10-04-lucid-lynx/(适用于 Linux)

Yes, server side includes are the way to go, just a few clarifications:

1) You can do it as described by Sotiris if you choose to use PHP - which is very common choice, and btw.virtually all hosts support php.

2) Although the file will have extension .php, you can put your pure html code in it.

3) To be able to test and see this on your computer before uploading it, you have to install server on it. At this point I think it's simplest and fastest for you to go for some ready made solution - these are downloadable free:

http://www.wampserver.com/en/ (for Windows)

http://www.mamp.info/en/index.html (for Mac)

http://tuxtweaks.com/2010/04/installing-lamp-on-ubuntu-10-04-lucid-lynx/ (for Linux)

甲如呢乙后呢 2024-11-20 11:04:49

您可以创建一个包含所有必需代码的 php 文件(例如 footer.php)。然后您可以链接它,在每个页面的适当位置添加以下代码(例如,如果您想添加页脚):

<?php include "footer.php"; ?>

you can create a php file that will include all required code (for example footer.php). Then you can link it adding in every page in the proper place the following code (if you want to add the footer for example):

<?php include "footer.php"; ?>
偷得浮生 2024-11-20 11:04:49

如果您正在构建静态 HTML 页面,您可能需要考虑服务器端包含

http://en .wikipedia.org/wiki/Server_Side_Includes

If it is static HTML pages that you are builing, you probably want to think about Server Side Includes

http://en.wikipedia.org/wiki/Server_Side_Includes

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文