在多个页面中重复相同的HTML代码 [英] Repeat same HTML code in several pages

查看:157
本文介绍了在多个页面中重复相同的HTML代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难找到它,因为我不知道如何调用它。

I have a really hard time searching for this, because I have no idea how to call it.

我将尽力描述我想要的过程,并且看看你们中是否有人知道这样的编辑器。
我有一个网站,其中重复了相同的html组件,例如菜单。我可以使用CSS定义菜单的外观,但是我(据我所知)不能用简单的一行将相同的html添加到每个html页面。
我要做的是将菜单复制到每个地方。如果更改菜单,则需要再次执行所有操作。
我知道这可以通过使用动态服务器来实现,例如php或jsp,但我并不需要动态。

I'll try to describe the process I want, and see if any of you know such an editor. I have a website that has the same html component repeated in them, for example, a menu. I can define how the menu looks with css, but I can't (as far as I know) add the same piece of html to every html page with a simple line. What I do, is copy the menu over to every place. If I change the menu, I need to do it all again. I know this can be achieved by using a dynamic server, with something like php or jsp, but I don't need it to be dynamic.

I想知道是否有办法做到这一点。
我以为可能有一个编辑器,可以在其中使用includes编辑html,然后在修改后编译 html,以生成将在服务器上替换的html。

I was wondering if there was a way to do this. I thought possibly there was an editor, where I can edit html using includes, and then "compile" the htmls after modification to produce the htmls I will replace on my server.

谢谢

推荐答案

看看服务器端包含 ...创建一个 menu.shtml 页面,然后像这样包含它:

Have a look at server side includes ... create a menu.shtml page and then include it like so :

<!--#include virtual="/menu.shtml" -->

大多数Web服务器(包括IIS,Apache和lighttpd)都支持它

Its supported by most web servers out of the box (including IIS, Apache and lighttpd)

这篇关于在多个页面中重复相同的HTML代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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