<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lifetype.org.tw/skins/common/feed.css?164"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>The Concept of Template - 修訂沿革</title>
		<link>http://wiki.lifetype.org.tw/index.php?title=The_Concept_of_Template&amp;action=history</link>
		<description>本站上此頁的修訂沿革</description>
		<language>zh-tw</language>
		<generator>MediaWiki 1.13.2</generator>
		<lastBuildDate>Sun, 24 May 2026 15:13:29 GMT</lastBuildDate>
		<item>
			<title>Bibicall在2006年10月19日 (四) 03:45</title>
			<link>http://wiki.lifetype.org.tw/index.php?title=The_Concept_of_Template&amp;diff=1928&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←上一修訂&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;在2006年10月19日 (四) 03:45所做的修訂版本&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第65行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第65行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;說完了LifeType模版的基本結構，那這些模版究竟是如何運作，成為最後呈現在網頁上面的樣子？以下借用[http://www.php5.idv.tw/documents/smarty/smarty20040209.htm Jace Ju的Smarty入門]中的Smarty樣版引擎運作示意圖，來說明LifeType模版的運作流程。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;說完了LifeType模版的基本結構，那這些模版究竟是如何運作，成為最後呈現在網頁上面的樣子？以下借用[http://www.php5.idv.tw/documents/smarty/smarty20040209.htm Jace Ju的Smarty入門]中的Smarty樣版引擎運作示意圖，來說明LifeType模版的運作流程。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;圖片連結：http://forum.lifetype.org.tw/index.php?action=dlattach;topic=1552.0;id=89;image&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(圖片後補)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-05-24 15:13:29 --&gt;
&lt;/table&gt;</description>
			<pubDate>Thu, 19 Oct 2006 03:45:20 GMT</pubDate>			<dc:creator>Bibicall</dc:creator>			<comments>http://wiki.lifetype.org.tw/index.php/%E8%A8%8E%E8%AB%96:The_Concept_of_Template</comments>		</item>
		<item>
			<title>Bibicall: /* 模版如何運作？ */</title>
			<link>http://wiki.lifetype.org.tw/index.php?title=The_Concept_of_Template&amp;diff=1688&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;模版如何運作？&lt;/span&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←上一修訂&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;在2006年2月4日 (六) 08:20所做的修訂版本&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第59行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第59行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;利用這樣的方式，當我們修改模版頁首的呈現時，只需針對header.template修改一次，即可達到全部修改的目的。也因此，才會出現 commentform.template、post.template等檔案的出現。而這些模版中，我們已經知道header.template與 footer.template，分別控制頁面的頁首與頁尾呈現，在此簡單敘述commentform.template與post.template這兩個檔案的作用：&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;利用這樣的方式，當我們修改模版頁首的呈現時，只需針對header.template修改一次，即可達到全部修改的目的。也因此，才會出現 commentform.template、post.template等檔案的出現。而這些模版中，我們已經知道header.template與 footer.template，分別控制頁面的頁首與頁尾呈現，在此簡單敘述commentform.template與post.template這兩個檔案的作用：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;commentform.template：這個檔案主要包含了提交迴響的表格，因為也具有可重複使用的特性，因此將其獨立出來，再以匯入的方式工其他檔案使用。一般來說，這個檔案常用在postandcomments.template之中。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;commentform.template：這個檔案主要包含了提交迴響的表格，因為也具有可重複使用的特性，因此將其獨立出來，再以匯入的方式工其他檔案使用。一般來說，這個檔案常用在postandcomments.template之中。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;post.template：這個檔案主要包含了網誌的文章內容，一般來說，這個檔案常用在main.template與postandcomments.template之中。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;post.template：這個檔案主要包含了網誌的文章內容，一般來說，這個檔案常用在main.template與postandcomments.template之中。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;(以上摘譯改寫自 LifeType英文wiki文件，下方Smarty如何產生php頁面的圖解與說明，改寫自Mark Wu的0.32 版教學投影片。)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;(以上摘譯改寫自 LifeType英文wiki文件，下方Smarty如何產生php頁面的圖解與說明，改寫自Mark Wu的0.32 版教學投影片。)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-05-24 15:13:29 --&gt;
&lt;/table&gt;</description>
			<pubDate>Sat, 04 Feb 2006 08:20:24 GMT</pubDate>			<dc:creator>Bibicall</dc:creator>			<comments>http://wiki.lifetype.org.tw/index.php/%E8%A8%8E%E8%AB%96:The_Concept_of_Template</comments>		</item>
		<item>
			<title>Bibicall在2006年2月4日 (六) 08:19</title>
			<link>http://wiki.lifetype.org.tw/index.php?title=The_Concept_of_Template&amp;diff=1687&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 模版如何運作？ ==&lt;br /&gt;
&lt;br /&gt;
前面提到過，LifeType使用Smarty引擎來產生網誌的網頁內容。也就意味著使用者可以輕易的在後台管理介面中，更換模版改變網頁的外觀。但，模版是如何運作？使用者又該如何製作屬於自己的模版呢？&lt;br /&gt;
&lt;br /&gt;
開始之前必須先知道的是，所有的模版存放在LifeType架構中的哪一個位置。LifeType的模版是存放在*templates/*之下，在這個資料夾中，除了網誌可以使用的模版之外，還包含了後台頁面(admin)、摘要頁面(summary)、安裝精靈(wizard)、RSS feed頁面(rss)以及郵件通告(misc)等模版。&lt;br /&gt;
&lt;br /&gt;
LifeType預設的網誌模版有三個，分別是standard、grey與blueish。以grey模版為例，在grey資料夾中，我們可以看到以下的*.template文件檔：&lt;br /&gt;
&lt;br /&gt;
*'''commentarticle.template'''&lt;br /&gt;
*commentform.template&lt;br /&gt;
*demosites.template&lt;br /&gt;
*'''error.template'''&lt;br /&gt;
*features.template&lt;br /&gt;
*footer.template&lt;br /&gt;
*header.template&lt;br /&gt;
*'''main.template'''&lt;br /&gt;
*post.template&lt;br /&gt;
*'''postandcomments.template'''&lt;br /&gt;
*'''posttrackbacks.template'''&lt;br /&gt;
*samplerss.template&lt;br /&gt;
*'''album.template'''&lt;br /&gt;
*'''albums.template'''&lt;br /&gt;
*'''resource.template'''&lt;br /&gt;
*'''searchresults.template'''&lt;br /&gt;
&lt;br /&gt;
在這16個*.template文件檔中，以粗體表示的是最基本的模版，也是必須存在的模版。這9個模版更是網誌運作與呈現不可缺少的。以下簡述9個檔案的基本功能：&lt;br /&gt;
&lt;br /&gt;
*main.template：這個檔案控制網誌的主頁面。&lt;br /&gt;
*postandcomments.template：這個檔案控制網誌文章內容與迴響內容的呈現。&lt;br /&gt;
*commentarticle.template：這個檔案主要用來顯示新增（或回覆）迴響時的表單。&lt;br /&gt;
*posttrackbacks.template：用來顯示網誌文章的所有引用資訊。&lt;br /&gt;
*error.template：顯示錯誤訊息用。&lt;br /&gt;
*album.template：顯示資源中心資料夾下的檔案。&lt;br /&gt;
*albums.template：與上述檔案不同之處，這個檔案室用來顯示資源中心裡所有最上層的資料夾。&lt;br /&gt;
*resource.template：用來顯示檔案詳細資料。&lt;br /&gt;
*searchresults.template：顧名思義，就是用來顯示網誌中搜尋結果。&lt;br /&gt;
&lt;br /&gt;
看到這，或許有人會懷疑，既然只需要9個模版檔案即可，那為何又多出7個額外的檔案？這7個檔案或許不起眼，但卻是修改模版中不可缺的幫手，有了這7個檔案，讓模版的修改更加容易。&lt;br /&gt;
&lt;br /&gt;
上述9個主要模版檔案中，每一個檔案都必須有完整的網頁結構，才能讓網誌正常運作。而這些網頁呈現所需的結構，有部分是一再重複的。在製作模版的過程中，如果要讓每個頁面有相同的頁首與頁尾，沒別的辦法，只能重複的執行「複製、貼上」的動作9次。若不幸中途做了點修改，那又得回頭去「複製、貼上」。&lt;br /&gt;
&lt;br /&gt;
幸好，Smarty允許使用{include...}標籤在當案中匯入另一個檔案，只要在標籤中加上參數「file」，並設定好匯入檔案的路徑即可。有了這樣的功能，在製作或修改模版的時候，我們只需將會重複使用的部分寫成一個檔案，再利用{include...}標籤將其匯入LifeType的主要模版之中。&lt;br /&gt;
&lt;br /&gt;
以頁首與頁尾為例子，若所有模版均使用相同的頁首(header)與頁尾(footer)，那麼模版開發者只需將頁首頁尾的部分另外寫成header.template與footer.template兩個檔案，再用{include...}標籤匯入到主要的模版檔案中，方法如下：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding: 5px; margin: 10px 30px 5px 30px; border: 1px dashed darkslateblue&amp;quot;&amp;gt;&lt;br /&gt;
{include file=&amp;quot;$blogtemplate/header.template&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
模版內容&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
{include file=&amp;quot;$blogtemplate/footer.template&amp;quot;}&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
有一點須注意的是，{include...}標籤中使用的路徑是相對於templates/ 資料夾的。另外，也可以使用$blogtemplate變數來表示templates/底下各個模版資料夾的名稱，這樣一來就算模版資料夾更名或搬移，也不會影響模版的運作。&lt;br /&gt;
&lt;br /&gt;
利用這樣的方式，當我們修改模版頁首的呈現時，只需針對header.template修改一次，即可達到全部修改的目的。也因此，才會出現 commentform.template、post.template等檔案的出現。而這些模版中，我們已經知道header.template與 footer.template，分別控制頁面的頁首與頁尾呈現，在此簡單敘述commentform.template與post.template這兩個檔案的作用：&lt;br /&gt;
&lt;br /&gt;
commentform.template：這個檔案主要包含了提交迴響的表格，因為也具有可重複使用的特性，因此將其獨立出來，再以匯入的方式工其他檔案使用。一般來說，這個檔案常用在postandcomments.template之中。&lt;br /&gt;
post.template：這個檔案主要包含了網誌的文章內容，一般來說，這個檔案常用在main.template與postandcomments.template之中。&lt;br /&gt;
&lt;br /&gt;
(以上摘譯改寫自 LifeType英文wiki文件，下方Smarty如何產生php頁面的圖解與說明，改寫自Mark Wu的0.32 版教學投影片。)&lt;br /&gt;
&lt;br /&gt;
說完了LifeType模版的基本結構，那這些模版究竟是如何運作，成為最後呈現在網頁上面的樣子？以下借用[http://www.php5.idv.tw/documents/smarty/smarty20040209.htm Jace Ju的Smarty入門]中的Smarty樣版引擎運作示意圖，來說明LifeType模版的運作流程。&lt;br /&gt;
&lt;br /&gt;
(圖片後補)&lt;/div&gt;</description>
			<pubDate>Sat, 04 Feb 2006 08:19:34 GMT</pubDate>			<dc:creator>Bibicall</dc:creator>			<comments>http://wiki.lifetype.org.tw/index.php/%E8%A8%8E%E8%AB%96:The_Concept_of_Template</comments>		</item>
	</channel>
</rss>