拆分一个html页面并通过标题加载它?

Splitting up a html page and loading it through header?(拆分一个html页面并通过标题加载它?)

本文介绍了拆分一个html页面并通过标题加载它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 HTML5,并希望通过将标准 HTML 模板拆分为三个单独的 HTML 文件来加快创建和编辑的速度.

I am using HTML5, and would like to speed up the creation and editing of my standard HTML template by splitting it into three separate HTML files.

  • header.html
  • content.html(这将被编辑并具有其他名称,例如 home)
  • 页脚.html

我查看了以下资源,但我不确定这是否可行或如何去做.

I have looked at the following resources, but I am not sure if this is possible or how to go about it.

http://www.w3schools.com/html/html_head.asp

http://www.w3schools.com/tags/tag_link.asp

在 PHP 中,我只会按正确的顺序包含文件.在纯 HTML 网站中是否有等价物?

In PHP I would just include the files in the right order. Is there an equivelant in just a plain HTML site?

我已经用谷歌搜索了这个,但我认为我没有找到正确的术语.我将不胜感激任何可用的信息或资源!

I have googled this, but I don't think Im searching for the right term. I would appreciate any information, or resources available!

感谢您的宝贵时间!

推荐答案

对于一个静态 HTML 站点,没有 html-only 方法可以按照您尝试的方式包含文件.您可能能够使用服务器端包含,具体取决于您的服务器,但到那时,您还不如只使用 PHP.

For just a static HTML site, there is no html-only way to include files the way you are trying to. You may be able to use server-side includes depending on your server, but by that point, you might as well just use PHP.

另一种选择是在页面的主要部分已经加载后广泛使用 Javascript 来加载页面片段.

Another option would be to make extensive use of Javascript to load the page pieces after the main part of the page is already loaded.

但是,在所有情况下,性能都会大大降低,因为服务器请求很慢.如果您需要使用模板,只需使用 PHP 等动态语言即可.

In all cases, though, you will have a major reduction in performance, since a server request is slow. If you need to use templates, just use a dynamic language like PHP.

这篇关于拆分一个html页面并通过标题加载它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:拆分一个html页面并通过标题加载它?