SHTML - SSI技术[收藏]
2005-02-17 02:09
417 查看
概要:
什么是shtml SHTML语法 SHTML教程 格式 编写 技术
使用SSI (Server Side Include)技术
想要找到既富有创意的平面设计人员,又有脚本开发经验的人员,实在是太难了。而如果一个百分之百的页面都是php脚本的网站,将为页面维护带来非常大的困难。而且使用了php的自动加头和加尾的方法,使得几乎所有页面都是语义不完整的,不能借助任何一款页面设计工具工作,是另一个弊病。
利用SSI技术,可以有效的将HTML网页和CGI脚本逻辑上分开,也可以将重复的HTML元素抽象和独立出来,减轻维护负担。
SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology.
全文:
配置Apache,支持SSI
SSI语法
Basic SSI directives Syntax
Today's date
Modification date of the file
Including the results of a CGI program
You can use "#exec cgi=" directive, but it can be disabled using the IncludesNOEXEC Option.
Including a standard footer
Executing commands
This feature is dangerous. You can allow SSI, but not the exec feature, with the IncludesNOEXEC argument to the Options directive.
Setting variables
Conditional expressions
1、Config命令
Config命令主要用于修改SSI的默认设置。其中:
Errmsg:设置默认错误信息。为了能够正常的返回用户设定的错误信息,在HTML文件中Errmsg参数必须被放置在其它SSI命令的前面,否则客户端只能显示默认的错误信息,而不是由用户设定的自定义信息。
<!--#config errmsg="Error! Please email webmaster@mydomain.com -->
Timefmt:定义日期和时间的使用格式。Timefmt参数必须在echo命令之前使用。
<!--#config timefmt="%A, %B %d, %Y"-->
<!--#echo var="LAST_MODIFIED" -->
显示结果为:
Wednesday, April 12, 2000
也许用户对上例中所使用的%A %B %d感到很陌生,下面我们就以表格的形式总结一下SSI中较为常用的一些日期和时间格式。 www.domain.com
Sizefmt:决定文件大小是以字节、千字节还是兆字节为单位表示。如果以字节为单位,参数值为"bytes";对于千字节和兆字节可以使用缩写形式。同样,sizefmt参数必须放在fsize命令的前面才能使用。
<!--#config sizefmt="bytes" -->
<!--#fsize file="index.html" -->
2、Include命令
Include命令可以把其它文档中的文字或图片插入到当前被解析的文档中,这是整个SSI的关键所在。通过Include命令只需要改动一个文件就可以瞬间更新整个站点!
Include命令具有两个不同的参数:
Virtual:给出到服务器端某个文档的虚拟路径。例如:
<!--#include virtual="/includes/header.html" -->
File:给出到当前目录的相对路径,其中不能使用"../",也不能使用绝对路径。例如:
<!--#include file="header.html" -->
这就要求每一个目录中都包含一个header.html文件。
3、Echo命令
Echo命令可以显示以下各环境变量:
DOCUMENT_NAME:显示当前文档的名称。
<!--#echo var="DOCUMENT_NAME" -->
显示结果为:
index.html
DOCUMENT_URI:显示当前文档的虚拟路径。例如:
<!--#echo var="DOCUMENT_URI" -->
显示结果为:
/YourDirectory/YourFilename.html
随着网站的不断发展,那些越来越长的URL地址肯定会让人头疼。如果使用SSI,一切就会迎刃而解。
另外一个关于apache中ssi技术的教程可以查阅:
Apache指南:服务器端包含入门
http://www.kreny.com/doc/apache2.0/howto/ssi.html
参考网页
http://www.worldhello.net/doc/website_howto/ssi.html
http://www.7880.com/Info/Article-2f11dda0.html
http://www.carleton.ca/~dmcfet/html/ssi.html
http://www.dizign.de/ssi/
什么是shtml SHTML语法 SHTML教程 格式 编写 技术
使用SSI (Server Side Include)技术
想要找到既富有创意的平面设计人员,又有脚本开发经验的人员,实在是太难了。而如果一个百分之百的页面都是php脚本的网站,将为页面维护带来非常大的困难。而且使用了php的自动加头和加尾的方法,使得几乎所有页面都是语义不完整的,不能借助任何一款页面设计工具工作,是另一个弊病。
利用SSI技术,可以有效的将HTML网页和CGI脚本逻辑上分开,也可以将重复的HTML元素抽象和独立出来,减轻维护负担。
SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology.
全文:
配置Apache,支持SSI
# This tells Apache that you want to permit files to # be parsed for SSI directives. Options +Includes # At linux or unix can use # Options +Includes -IncludesNOEXEC # win32 not use it # You have to tell Apache which files should be parsed. AddType text/html .shtml AddHandler server-parsed .shtml |
Basic SSI directives Syntax
<!--#element attribute=value attribute=value ... --> |
<!--#config timefmt="%Y/%m/%d %a %H:%M:%S" --> Today is <!--#echo var="DATE_LOCAL" --> |
This document last modified <!--#flastmod file="index.html" --> |
<!--#include virtual="/cgi-bin/counter.pl" --> <!--#include virtual="/cgi-bin/example.cgi?argument=value" --> |
Including a standard footer
<!--#include virtual="/footer.html" --> |
<!--#exec cmd="ls" --> |
Setting variables
<!--#set var="modified" value="$LAST_MODIFIED" --> <!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" --> |
<!--#if expr="test_condition" --> <!--#elif expr="test_condition" --> <!--#else --> <!--#endif --> |
Config命令主要用于修改SSI的默认设置。其中:
Errmsg:设置默认错误信息。为了能够正常的返回用户设定的错误信息,在HTML文件中Errmsg参数必须被放置在其它SSI命令的前面,否则客户端只能显示默认的错误信息,而不是由用户设定的自定义信息。
<!--#config errmsg="Error! Please email webmaster@mydomain.com -->
Timefmt:定义日期和时间的使用格式。Timefmt参数必须在echo命令之前使用。
<!--#config timefmt="%A, %B %d, %Y"-->
<!--#echo var="LAST_MODIFIED" -->
显示结果为:
Wednesday, April 12, 2000
也许用户对上例中所使用的%A %B %d感到很陌生,下面我们就以表格的形式总结一下SSI中较为常用的一些日期和时间格式。 www.domain.com
Sizefmt:决定文件大小是以字节、千字节还是兆字节为单位表示。如果以字节为单位,参数值为"bytes";对于千字节和兆字节可以使用缩写形式。同样,sizefmt参数必须放在fsize命令的前面才能使用。
<!--#config sizefmt="bytes" -->
<!--#fsize file="index.html" -->
2、Include命令
Include命令可以把其它文档中的文字或图片插入到当前被解析的文档中,这是整个SSI的关键所在。通过Include命令只需要改动一个文件就可以瞬间更新整个站点!
Include命令具有两个不同的参数:
Virtual:给出到服务器端某个文档的虚拟路径。例如:
<!--#include virtual="/includes/header.html" -->
File:给出到当前目录的相对路径,其中不能使用"../",也不能使用绝对路径。例如:
<!--#include file="header.html" -->
这就要求每一个目录中都包含一个header.html文件。
3、Echo命令
Echo命令可以显示以下各环境变量:
DOCUMENT_NAME:显示当前文档的名称。
<!--#echo var="DOCUMENT_NAME" -->
显示结果为:
index.html
DOCUMENT_URI:显示当前文档的虚拟路径。例如:
<!--#echo var="DOCUMENT_URI" -->
显示结果为:
/YourDirectory/YourFilename.html
随着网站的不断发展,那些越来越长的URL地址肯定会让人头疼。如果使用SSI,一切就会迎刃而解。
另外一个关于apache中ssi技术的教程可以查阅:
Apache指南:服务器端包含入门
http://www.kreny.com/doc/apache2.0/howto/ssi.html
参考网页
http://www.worldhello.net/doc/website_howto/ssi.html
http://www.7880.com/Info/Article-2f11dda0.html
http://www.carleton.ca/~dmcfet/html/ssi.html
http://www.dizign.de/ssi/
相关文章推荐
- SSI技术——SHTML(生成静态时用的最火)
- SHTML - SSI技术
- SSI技术―SHTML的解释(生成静态时用的最火)
- Apache Tomcat关于shtml和SSI技术
- 收藏的iOS技术站点汇总(持续更新ing)
- 10大实用web应用界面技术收藏
- UIAlertController高级之嵌入其他控件 分类: ios技术 2015-02-02 11:58 96人阅读 评论(0) 收藏
- Apache开启SSI配置以及针对shtml开启apache相关设置
- 技术网址收藏;
- JS 循环遍历JSON数据 分类: JS技术 JS JQuery 2010-12-01 13:56 43646人阅读 评论(5) 收藏 举报 jsonc JSON数据如:{"options":"[{
- 【收藏】Java开发者必去的技术网站
- [收藏]论.NET反射、委托技术与设计模式关系
- AJAX技术简介及入门实例[收藏]
- 【收藏一个】 今年12306的表现貌似还不错!抢票插件火了一把!看看技术总监邵辉给出的设计。
- 收罗了一些关于BI数据领域以及ETL技术论坛地址,欢迎收藏
- 动态缓存技术之CSI,SSI,ESI
- 【收藏篇】9月优秀技术博文整合,值得收藏!
- 这些年收藏的技术大牛博客分享(后续还会继续更新)大家可以在评论中分享自己关注的
- 我收藏的技术知识图(每张都是大图)
- 分布式技术 webapi 路由追加html、aspx、shtml 适用于 对接 安卓、IOS