简体   繁体   English

HTML 静态文件模板的可用选项

[英]Available Options for HTML Static File Templating

What are the most common options for templating HTML files for static pages, to minimize maintenance and redundancy?为静态页面模板化 HTML 文件以最小化维护和冗余的最常见选项是什么? An example of my question would be Adobe Dreamweaver.我的问题的一个例子是 Adob​​e Dreamweaver。

why dont you use iframe inside ?你为什么不在里面使用 iframe 呢? ( which will contain a single navigation html page...)? (其中将包含单个导航 html 页面...)?

Consider using a server-side scripting language such as PHP or ASP.NET.考虑使用服务器端脚本语言,例如 PHP 或 ASP.NET。 These produce dynamically built web-pages meaning that you can code it in such a way that headers/footers etc are separate from the main content, meaning you change that link once rather than 30 times.这些会生成动态构建的网页,这意味着您可以以页眉/页脚等与主要内容分开的方式对其进行编码,这意味着您可以更改该链接一次而不是 30 次。

If server-side scripting is not an option, I'd suggest having a look at Dreamweaver.如果服务器端脚本不是一个选项,我建议看看 Dreamweaver。 This will enable you to create templates, and then create pages based on those templates.这将使您能够创建模板,然后根据这些模板创建页面。 When you modify that link in the template, all pages that use that template will be updated.当您在模板中修改该链接时,所有使用该模板的页面都将更新。 This will give you what you want without the server-side scripting.这将在没有服务器端脚本的情况下为您提供所需的内容。

If you're using a server-side language like PHP, you can start to use the include function.如果您使用像 PHP 这样的服务器端语言,您可以开始使用include函数。 So you'll include in a different file your navigation bar and then include it in every file of your website.因此,您会将导航栏包含在不同的文件中,然后将其包含在网站的每个文件中。 Thus, every change to the navigation bar file will affect all the others files.因此,对导航栏文件的每次更改都会影响所有其他文件。

If you are writing only static pages, it isn't possible.如果您只编写静态页面,这是不可能的。 Maybe you can try SSI .也许你可以试试SSI

Typically you need either a fancy program (like Dreamweaver and its templates functionality) or some sort of server-side scripting.通常,您需要一个花哨的程序(如 Dreamweaver 及其模板功能)或某种服务器端脚本。 Languages like php, asp, etc might be a bit much if the only thing you are looking to do is as you describe, so I might look into seeing if your server support server side includes (SSI).如果您希望做的唯一事情是您所描述的,那么像 php、asp 等语言可能会有点多,所以我可能会调查您的服务器支持服务器端是否包括 (SSI)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM