国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 網(wǎng)站 > WEB開(kāi)發(fā) > 正文

SSI技術(shù)—SHTML(生成靜態(tài)時(shí)用的最火)

2024-04-27 13:56:24
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

什么是shtml SHTML語(yǔ)法 SHTML教程 格式 編寫 技術(shù)

使用SSI (Server Side Include)技術(shù)

想要找到既富有創(chuàng)意的平面設(shè)計(jì)人員,又有腳本開(kāi)發(fā)經(jīng)驗(yàn)的人員,實(shí)在是太難了。而如果一個(gè)百分之百的頁(yè)面都是php腳本的網(wǎng)站,將為頁(yè)面維護(hù)帶來(lái)非常大的困難。而且使用了php的自動(dòng)加頭和加尾的方法,使得幾乎所有頁(yè)面都是語(yǔ)義不完整的,不能借助任何一款頁(yè)面設(shè)計(jì)工具工作,是另一個(gè)弊病。

利用SSI技術(shù),可以有效的將HTML網(wǎng)頁(yè)和CGI腳本邏輯上分開(kāi),也可以將重復(fù)的HTML元素抽象和獨(dú)立出來(lái),減輕維護(hù)負(fù)擔(dān)。

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 .shtmlAddHandler server-parsed .shtml
 


 

SSI語(yǔ)法

 

Basic SSI directives Syntax

<!--#element attribute=value attribute=value ... -->
 

Today's date

<!--#config timefmt="%Y/%m/%d %a %H:%M:%S" -->Today is <!--#echo var="DATE_LOCAL" -->
 

Modification date of the file

This document last modified <!--#flastmod file="index.html" -->
 

Including the results of a CGI program

<!--#include virtual="/cgi-bin/counter.pl" --><!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
 

You can use "#exec cgi=" directive, but it can be disabled using the IncludesNOEXEC Option.

Including a standard footer

<!--#include virtual="/footer.html" -->
 

Executing commands

<!--#exec cmd="ls" -->
 

This feature is dangerous. You can allow SSI, but not the exec feature, with the IncludesNOEXEC argument to the Options directive.

Setting variables

<!--#set var="modified" value="$LAST_MODIFIED" --><!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" -->
 

Conditional expressions

<!--#if expr="test_condition" --><!--#elif expr="test_condition" --><!--#else --><!--#endif -->
 

1、Config命令

  Config命令主要用于修改SSI的默認(rèn)設(shè)置。其中:

  Errmsg:設(shè)置默認(rèn)錯(cuò)誤信息。為了能夠正常的返回用戶設(shè)定的錯(cuò)誤信息,在HTML文件中Errmsg參數(shù)必須被放置在其它SSI命令的前面,否則客戶端只能顯示默認(rèn)的錯(cuò)誤信息,而不是由用戶設(shè)定的自定義信息。

    <!--#config errmsg="Error! Please email webmaster@mydomain.com --> 

  Timefmt:定義日期和時(shí)間的使用格式。Timefmt參數(shù)必須在echo命令之前使用。

    <!--#config timefmt="%A, %B %d, %Y"-->
    <!--#echo var="LAST_MODIFIED" -->

  顯示結(jié)果為:
    
    Wednesday, April 12, 2000 

  也許用戶對(duì)上例中所使用的%A %B %d感到很陌生,下面我們就以表格的形式總結(jié)一下SSI中較為常用的一些日期和時(shí)間格式。

    <!--#config sizefmt="bytes" -->
    <!--#fsize file="index.html" --> 

  2、Include命令

  Include命令可以把其它文檔中的文字或圖片插入到當(dāng)前被解析的文檔中,這是整個(gè)SSI的關(guān)鍵所在。通過(guò)Include命令只需要改動(dòng)一個(gè)文件就可以瞬間更新整個(gè)站點(diǎn)!

  Include命令具有兩個(gè)不同的參數(shù):

  Virtual:給出到服務(wù)器端某個(gè)文檔的虛擬路徑。例如:

    <!--#include virtual="/includes/header.html" --> 

  File:給出到當(dāng)前目錄的相對(duì)路徑,其中不能使用"../",也不能使用絕對(duì)路徑。例如:

    <!--#include file="header.html" -->

  這就要求每一個(gè)目錄中都包含一個(gè)header.html文件。

  3、Echo命令

  Echo命令可以顯示以下各環(huán)境變量:

  DOCUMENT_NAME:顯示當(dāng)前文檔的名稱。

    <!--#echo var="DOCUMENT_NAME" -->

顯示結(jié)果為:

    index.html

  DOCUMENT_URI:顯示當(dāng)前文檔的虛擬路徑。例如:

    <!--#echo var="DOCUMENT_URI" -->

  顯示結(jié)果為:

    /YourDirectory/YourFilename.html 

  隨著網(wǎng)站的不斷發(fā)展,那些越來(lái)越長(zhǎng)的URL地址肯定會(huì)讓人頭疼。如果使用SSI,一切就會(huì)迎刃而解。

 

 

另外一個(gè)關(guān)于apache中ssi技術(shù)的教程可以查閱:

Apache指南:服務(wù)器端包含入門
http://www.kreny.com/doc/apache2.0/howto/ssi.html


參考網(wǎng)頁(yè)

http://www.worldhello.net/doc/website_howto/ssi.html

http://www.carleton.ca/~dmcfet/html/ssi.html

http://www.dizign.de/ssi/


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 二手房| 泽库县| 邹城市| 广东省| 丁青县| 墨玉县| 南阳市| 景宁| 炎陵县| 平果县| 淮安市| 祁阳县| 株洲市| 合作市| 德安县| 商都县| 忻州市| 阿拉善右旗| 博湖县| 泸水县| 汤阴县| 夏河县| 宁陕县| 湟中县| 绥德县| 会宁县| 壶关县| 德安县| 衡山县| 岳阳市| 陆丰市| 景东| 怀远县| 新泰市| 华坪县| 都江堰市| 西林县| 漯河市| 托克逊县| 曲松县| 高邑县|