如何将相同的内容应用于多个html页面 [英] How to apply same content to multiple html pages

查看:291
本文介绍了如何将相同的内容应用于多个html页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是html新手,想知道是否有办法一次将相同的内容应用到很多html文件中。例如,如果我有很多页面,但所有这些页面都有一个完全相同的导航侧面板,其中包含所有其他页面的链接。有没有办法改变这个侧面板的内容而不改变每个页面的内容?
ie ie有一个功能,允许我在一个单独的文件中创建此导航面板,然后告诉我的所有页面包含此导航文件?



我知道一个css文件可以控制很多html页面的格式 - 有没有一种类比的方法可以控制很多html页面的内容? 解决方案

你可以使用PHP来做到这一点。用PHP文件编写HTML代码,然后在HTML中添加include语句。这节省了您不得不一次又一次地编写相同的代码,专门用于导航等。

PHP手册解释它。



希望它有帮助。


I'm new to html and was wondering if there is a way to apply the same content to many html files at once.

For example, if I have many pages, but all those pages have an identical navigation side panel that contains links to all the other pages. Is there any way to change the contents of this side panel without changing it for each individual page? i.e. is there a feature that allows me to make this navigation panel in a separate file, then tell all my pages to include this navigation file?

I know a css file can control the format of many html pages - is there an analogy to this that can control the content of many html pages?

解决方案

You can use PHP to do that. Write the HTML code in PHP file, then add include statement in your HTML. This saves you from having to write same code again and again specially for navigation, etc.

PHP manual explains it.

Hope it helps.

这篇关于如何将相同的内容应用于多个html页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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