具有静态HTML的通用页眉/页脚 [英] Common Header / Footer with static HTML

查看:169
本文介绍了具有静态HTML的通用页眉/页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用静态HTML / XHTML创建常见的页眉/页脚文件以在网站的每个页面上显示是否有一种体面的方式?我知道你明显可以通过PHP或服务器端指令来做到这一点,但是有什么办法可以做到这一点吗?完全不依赖服务器将所有东西拼接在一起吗?

编辑:所有非常好的答案,是我的预期。 HTML是静态的,句号。如果没有运行服务器端或客户端的东西,没有真正的方法来改变它。我发现Server Side Includes似乎是我最好的选择,因为它们非常简单,并且不需要脚本。

解决方案

有三种方法可以做你想做的事

服务器脚本



这包括php,asp, jsp ....但是你说不对,

服务器端包含



你的服务器正在为那么为什么不利用内置的服务器端包括呢?每个服务器都有自己的方式来利用它。



客户端包含



这个解决方案你有没有在客户端加载过页面后回拨服务器。


Is there a decent way with static HTML/XHTML to create common header/footer files to be displayed on each page of a site? I know you can obviously do this with PHP or server side directives, but is there any way of doing this with absolutely no dependencies on the server stitching everything together for you?

Edit: All very good answers and was what I expected. HTML is static, period. No real way to change that without something running server side or client side. I've found that Server Side Includes seem to be my best option as they are very simple and don't require scripting.

解决方案

There are three ways to do what you want

Server Script

This includes something like php, asp, jsp.... But you said no to that

Server Side Includes

Your server is serving up the pages so why not take advantage of the built in server side includes? Each server has its own way to do this, take advantage of it.

Client Side Include

This solutions has you calling back to the server after page has already been loaded on the client.

这篇关于具有静态HTML的通用页眉/页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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