欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
PHP之Smarty模板引擎

前面的話(huà)

  對PHP來(lái)說(shuō),有很多模板引擎可供選擇,但Smarty是一個(gè)使用PHP編寫(xiě)出來(lái)的,是業(yè)界最著(zhù)名、功能最強大的一種PHP模板引擎。Smarty像PHP一樣擁有豐富的函數庫,從統計字數到自動(dòng)縮進(jìn)、文字環(huán)繞以及正則表達式都可以直接使用,如果覺(jué)得不夠,SMARTY還有很強的擴展能力,可以通過(guò)插件的形式進(jìn)行擴充。另外,Smarty也是一種自由軟件,用戶(hù)可以自由使用、修改,以及重新分發(fā)該軟件。本文將詳細介紹Smarty模板引擎

概述

  Smarty是一個(gè)php模板引擎。更準確的說(shuō),它分離了邏輯程序和外在的內容,提供了一種易于管理的方法。Smarty總的設計理念就是分離業(yè)務(wù)邏輯和表現邏輯,優(yōu)點(diǎn)概括如下:

  速度——相對于其他的模板引擎技術(shù)而言,采用Smarty編寫(xiě)的程序可以獲得最大速度的提高

  編譯型——采用Smarty編寫(xiě)的程序在運行時(shí)要編譯成一個(gè)非模板技術(shù)的PHP文件,這個(gè)文件采用了PHP與HTML混合的方式,在下一次訪(fǎng)問(wèn)模板時(shí)將Web請求直接轉換到這個(gè)文件中,而不再進(jìn)行模板重新編譯(在源程序沒(méi)有改動(dòng)的情況下),使用后續的調用速度更快

  緩存技術(shù)——Smarty提供了一種可選擇使用的緩存技術(shù),它可以將用戶(hù)最終看到的HTML文件緩存成一個(gè)靜態(tài)的HTML頁(yè)面。當用戶(hù)開(kāi)啟Smarty緩存時(shí),并在設定的時(shí)間內,將用戶(hù)的Web請求直接轉換到這個(gè)靜態(tài)的HTML文件中來(lái),這相當于調用一個(gè)靜態(tài)的HTML文件

  插件技術(shù)——Smarty模板引擎是采用PHP的面向對象技術(shù)實(shí)現,不僅可以在原代碼中修改,還可以自定義一些功能插件(按規則自定義的函數)

  強大的表現邏輯——在Smarty模板中能夠通過(guò)條件判斷以及迭代地處理數據,它實(shí)際上就是種程序設計語(yǔ)言,但語(yǔ)法簡(jiǎn)單,設計人員在不需要預備的編程知識前提下就可以很快學(xué)會(huì )

  模板繼承——模板的繼承是Smarty3的新事物。在模板繼承里,將保持模板作為獨立頁(yè)面而不用加載其他頁(yè)面,可以操縱內容塊繼承它們。這使得模板更直觀(guān)、更有效和易管理

  當然,也有不適合使用Smarty的地方。例如,需要實(shí)時(shí)更新的內容,需要經(jīng)常重新編譯模板,所以這類(lèi)型的程序使用Smarty會(huì )使模板處理速度變慢。另外,在小項目中也不適合使用Smarty模板,小項目因為項目簡(jiǎn)單而前端與后端兼于一人的項目,使用Smarty會(huì )在一定程度上喪失PHP開(kāi)發(fā)迅速的優(yōu)點(diǎn)

 
配置

【安裝】

  安裝Smarty很簡(jiǎn)單,到Smarty官方網(wǎng)站下載最新的穩定版本,然后解壓壓縮包,在解壓后的目錄可以看到一個(gè)名叫libs的Smarty類(lèi)庫目錄,直接將libs文件夾復制到程序主文件夾下即可

  [注意]Smarty要求web服務(wù)器運行php4.0以上版本

  libs文件夾下共包含以下6個(gè)文件
Smarty.class.php(主文件)
SmartyBC.class.php(兼容其他版本Smarty)
sysplugins/* (系統函數插件)
plugins/* (自定義函數插件)
Autoloader.php
debug.tpl

【實(shí)例化】

/* 并指定了Smarty.class.php所在位置,注意'S'是大寫(xiě)的*/ require './libs/Smarty.class.php'; 
/* 實(shí)例化Smarty類(lèi)的對象$smarty */ $smarty = new Smarty();

【init】

  Smarty要求4個(gè)目錄,默認下命名為:tempalates、templates_c、configs和cache。每個(gè)都是可以自定義的,可以分別修改Smarty類(lèi)屬性或相關(guān)方法:$template_dir、$compile_dir、$config_dir和$cache_dir

/** file: init.inc.php Smarty對象的實(shí)例化及初使化文件 */ 
define("ROOT", str_replace("\\", "/",dirname(__FILE__)).'/');
//指定項目的根路徑 require ROOT.'libs/Smarty.class.php';
//加載Smarty類(lèi)文件 $smarty = new Smarty();
//實(shí)例化Smarty類(lèi)的對象$smarty
/* 推薦用Smarty3以上版本方式設置默認路徑,成功后返回$smarty對象本身,可連貫操作 */
$smarty ->setTemplateDir(ROOT.'templates/')
//設置所有模板文件存放的目錄 // ->addTemplateDir(ROOT.'templates2/')
//可以添加多個(gè)模板目錄 ->setCompileDir(ROOT.'templates_c/')
//設置所有編譯過(guò)的模板文件存放的目錄 ->addPluginsDir(ROOT.'plugins/')
//添加模板擴充插件存放的目錄 ->setCacheDir(ROOT.'cache/')
//設置緩存文件存放的目錄 ->setConfigDir(ROOT.'configs');
//設置模板配置文件存放的目錄 $smarty->caching = false;
//設置Smarty緩存開(kāi)關(guān)功能 $smarty->cache_lifetime = 60*60*24;
//設置模板緩存有效時(shí)間段的長(cháng)度為1天 $smarty->left_delimiter = '<{';
//設置模板語(yǔ)言中的左結束符 $smarty->right_delimiter = '}>'; //設置模板語(yǔ)言中的右結束符

【demo】

<!-- main.tpl --> 
<!DOCTYPE html> 
<html lang="en">
 <head> 
<meta charset="UTF-8">
 <title>Document</title> 
</head>
 <body> 
<{$content}> 
</body> 
</html>
<?php 
require './init.inc.php'; 
$smarty -> assign('content','this is content.....');
$smarty -> display('main.tpl');
?>
基本語(yǔ)法

【注釋】

  模板注釋被*星號包圍,而兩邊的星號又被定界符包圍。注釋只存在于模板里面,而在輸出的頁(yè)面中不可見(jiàn)
<{* this is a comment *} >

【變量】

  模板變量用美元符號$開(kāi)始,可以包含數字、字母和下劃線(xiàn),這與php變量很像??梢砸脭到M的數字或非數字索引,當然也可以引用對象屬性和方法

  配置文件變量是一個(gè)不用美元符號$,而是用#號包圍著(zhù)變量(#hashmarks#),或者是一個(gè)$smarty.config形式的變量

  [注意]Smarty可以識別嵌入在雙引號中的變量

數學(xué)和嵌入標簽
{$x+$y} // 輸出x+y的和 {assign var=foo value=$x+$y} 
// 屬性中的變量 {$foo[$x+3]}
// 變量作為數組索引 {$foo={counter}+3}
// 標簽里面嵌套標簽 {$foo="this is message {counter}"}
// 引號里面使用標簽
定義數組 {assign var=foo value=[1,2,3]} {assign var=foo value=['y'=>'yellow','b'=>'blue']} {assign var=foo value=[1,[9,8],3]} // 可以嵌套 短變量分配 {$foo=$bar+2} {$foo = strlen($bar)} {$foo = myfunct( ($x+$y)*3 )} // 作為函數參數 {$foo.bar=1} // 賦值給指定的數組索引 {$foo.bar.baz=1} {$foo[]=1} 點(diǎn)語(yǔ)法 {$foo.a.b.c} => $foo['a']['b']['c'] {$foo.a.$b.c} => $foo['a'][$b]['c'] {$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c'] {$foo.a.{$b.c}} => $foo['a'][$b['c']] PHP語(yǔ)法 {$foo[1]} {$foo['bar']} {$foo['bar'][1]} {$foo[$x+$x]} {$foo[$bar[1]]} {$foo[section_name]}
<!-- main.tpl --> 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8"> 
<title>Document</title> 
</head> 
<body> 
<{***定義數組:10***}> 
<{assign var=foo value=[10,20,30]}> 
<{$foo[0]}><br> 
<{***短變量分配:0***}> 
<{$foo=0}> <{$foo}><br> 
<{***點(diǎn)語(yǔ)法:1***}> 
<{$test.a}><br> 
<{***PHP語(yǔ)法:1***}> 
<{$test['a']}><br> 
<{***數學(xué)運算:3***}> 
<{$test.a+$test.b}><br> 
</body> 
</html>
<?php 
require './init.inc.php'; 
$smarty -> assign('test',['a'=>1,'b'=>2]);
$smarty -> display('main.tpl');
?>

【函數】

  每一個(gè)smarty標簽輸出一個(gè)變量或者調用某種函數。在定界符內函數和其屬性將被處理和輸出

<{funcname attr1="val" attr2="val"}>
{config_load file="colors.conf"}

{include file="header.tpl"}

{if $highlight_name}
    Welcome, <div style="color:{#fontColor#}">{$name}!</div>    
{else}
    Welcome, {$name}!
{/if}

{include file="footer.tpl"}

【屬性】

  大多數函數都帶有自己的屬性以便于明確說(shuō)明或者修改他們的行為,smarty函數的屬性很像HTML中的屬性。靜態(tài)數值不需要加引號,但是字符串建議使用引號??梢允褂闷胀╯marty變量,也可以使用帶調節器的變量作為屬性值,它們也不用加引號。甚至可以使用php函數返回值和復雜表達式作為屬性值

  一些屬性用到了布爾值(true或false),它們表明為真或為假。如果沒(méi)有為這些屬性賦布爾值,那么默認使用true為其值

{include file="header.tpl"}
{include file="header.tpl" nocache} // 等于nocache=true {include file="header.tpl" attrib_name="attrib value"}

{include file=$includeFile}
{include file=#includeFile# title="My Title"} {assign var=foo value={counter}}
{assign var=foo value=substr($bar,2,5)}  
{assign var=foo value=$bar|strlen}  
{assign var=foo value=$buh+$bar|strlen}

{html_select_date display_days=true}

{mailto address="smarty@example.com"}

<select name="company_id">  
{html_options options=$companies selected=$company_id}
</select>

變量

  Smarty有幾種不同類(lèi)型的變量,變量的類(lèi)型取決于它的前綴符號是什么(或者被什么符號包圍)。Smarty的變量可以直接被輸出或者作為函數屬性和調節器(modifiers)的參數,或者用于內部的條件表達式等等。如果要輸出一個(gè)變量,只要用定界符將它括起來(lái)就可以

1、從PHP分配的變量

index.php: $smarty = new Smarty;
$smarty->assign('Contacts',array('fax' => '555-222-9876','email' => 'zaphod@slartibartfast.com'));
$smarty->display('index.tpl');

index.tpl: <{$Contacts.fax}><br> <{$Contacts.email}><br>

OUTPUT: 555-222-9876<br>
zaphod@slartibartfast.com<br>

2、從配置文件讀取的變量

  加載配置文件后,配置文件中的變量需要用兩個(gè)井號"#"包圍或者是smarty的保留變量$smarty.config.來(lái)調用

foo.conf:
pageTitle = "This is mine"
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"

<!-- main.tpl -->
<{config_load file='foo.conf'}>
<!DOCTYPE>
<html>
<title><{#pageTitle#}></title>
<body>
<table style="background:<{#tableBgColor#}>">
    <tr style="background:<{#rowBgColor#}>">
        <td>First</td>
        <td>Last</td>
        <td>Address</td>
    </tr>
</table>
</body>
</html> 


<?php 
require './init.inc.php'; 
$smarty -> display('main.tpl');
?>
3、配置文件里分區域的變量
foo.conf:

[a]
x=1

[b]
x=2

[c]
x=3

<!-- main.tpl -->
<{config_load file='foo.conf' section="a"}>
<{#x#}>

output:
1

4、模板里定義的變量

?
1
2
3
4
5
<{$name='Bob'}>
The value of $name is <{$name}>. 
output:
The value of $name is Bob.

 5、保留變量

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$smarty.get
$smarty.post
$smarty.cookies
$smarty.server
$smarty.env
$smarty.session
$smarty.request
$smarty.now             //當前時(shí)間戳
$smarty.const             //訪(fǎng)問(wèn)php常量
$smarty.capture         //捕獲內置的{capture}...{/capture}模版輸出
$smarty.config             //取得配置變量。{$smarty.config.foo}是{#foo#}的同義詞
$smarty.section         //指向{section}循環(huán)的屬性
$smarty.template         //返回經(jīng)過(guò)處理的當前模板名
$smarty.current_dir     //返回經(jīng)過(guò)處理的當前模板目錄名
$smarty.version         //返回經(jīng)過(guò)編譯的Smarty模板版本號

 

?
1
2
3
4
5
6
<!-- main.tpl -->
<{$smarty.now}><br>
<{date('Y-m-d',$smarty.now)}><br>
<{$smarty.template }><br>       
<{$smarty.current_dir }><br>   
<{$smarty.version }><br>

 

變量調節器

  變量調節器作用于變量、自定義函數或字符串。變量調節器的用法是:‘|’符號右接調節器名稱(chēng)。變量調節器可接收附加參數影響其行為。參數位于調節器右邊,并用‘:’符號分開(kāi)

  [注意]對于同一個(gè)變量,可以使用多個(gè)修改器。它們將從左到右按照設定好的順序被依次組合使用。使用時(shí)必須要用"|"字符作為它們之間的分隔符

capitalize[首字符大寫(xiě)]

  將變量里的所有單詞首字大寫(xiě),與php的ucwords()函數類(lèi)似。默認參數為false用于確定帶數字的單詞是否需要大寫(xiě)

?
1
2
3
4
5
6
7
8
9
10
<{$articleTitle="next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|capitalize}><br>
<{$articleTitle|capitalize:true}> <br>
output:
next x-men film, x3, delayed.
Next X-Men Film, x3, Delayed.
Next X-Men Film, X3, Delayed.

 

lower[小寫(xiě)]

  將變量字符串小寫(xiě),作用等同于php的strtolower()函數

?
1
2
3
4
5
6
7
8
<{$articleTitle="Next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|lower}><br>
output:
Next x-men film, x3, delayed.
next x-men film, x3, delayed.

 

upper[大寫(xiě)]

  將變量改為大寫(xiě),等同于php的strtoupper()函數

?
1
2
3
4
5
6
7
8
<{$articleTitle="Next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|upper}><br>
output:
Next x-men film, x3, delayed.
NEXT X-MEN FILM, X3, DELAYED.

 cat[連接字符串]

  將cat里的值后接到給定的變量后面

?
1
2
3
<{$articleTitle="next x-men film, x3, delayed."}> <{$articleTitle|cat:" yesterday."}>
OUTPUT: next x-men film, x3, delayed. yesterday.

 

count_characters[字符計數]

  計算變量里的字符數。默認參數為false,用于確定是否計算空格字符

?
1
2
3
4
5
6
7
8
9
<{$articleTitle="next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|count_characters}><br>
<{$articleTitle|count_characters:true}><br>
OUTPUT:
next x-men film, x3, delayed.
25
29

 

count_paragraphs[計算段數]

  計算變量里的段落數量

?
1
2
3
4
5
6
7
<{$articleTitle="next x-men\n film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|count_paragraphs}><br>
OUTPUT:
next x-men film, x3, delayed.
2

 

count_sentences[計算句數]

  計算變量里句子的數量

?
1
2
3
4
5
6
7
<{$articleTitle="next x-men. film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|count_sentences}><br>
OUTPUT:
next x-men. film, x3, delayed.
2

 count_words[計算詞數]

  計算變量里的詞數

?
1
2
3
4
5
6
7
<{$articleTitle="next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|count_words}><br>
OUTPUT:
next x-men film, x3, delayed.
5

 date_format[格式化日期]

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
%a - 當前區域星期幾的簡(jiǎn)寫(xiě)
%A - 當前區域星期幾的全稱(chēng)
%b - 當前區域月份的簡(jiǎn)寫(xiě)
%B - 當前區域月份的全稱(chēng)
%c - 當前區域首選的日期時(shí)間表達
%C - 世紀值(年份除以 100 后取整,范圍從 00 到 99)
%d - 月份中的第幾天,十進(jìn)制數字(范圍從 01 到 31)
%D - 和 %m/%d/%y 一樣
%e - 月份中的第幾天,十進(jìn)制數字,一位的數字前會(huì )加上一個(gè)空格(范圍從 ' 1' '31'
%g - 和 %G 一樣,但是沒(méi)有世紀
%G - 4 位數的年份,符合 ISO 星期數(參見(jiàn) %V)。和 %V 的格式和值一樣,只除了如果 ISO 星期數屬于前一年或者后一年,則使用那一年。
%h - 和 %b 一樣
%H - 24 小時(shí)制的十進(jìn)制小時(shí)數(范圍從 00 到 23)
%I - 12 小時(shí)制的十進(jìn)制小時(shí)數(范圍從 00 到 12)
%j - 年份中的第幾天,十進(jìn)制數(范圍從 001 到 366)
%m - 十進(jìn)制月份(范圍從 01 到 12)
%M - 十進(jìn)制分鐘數
%n - 換行符
%p - 根據給定的時(shí)間值為 `am' 或 `pm',或者當前區域設置中的相應字符串
%r - 用 a.m. 和 p.m. 符號的時(shí)間
%R - 24 小時(shí)符號的時(shí)間
%S - 十進(jìn)制秒數
%t - 制表符
%T - 當前時(shí)間,和 %H:%M:%S 一樣
%u - 星期幾的十進(jìn)制數表達 [1,7],1 表示星期一
%U - 本年的第幾周,從第一周的第一個(gè)星期天作為第一天開(kāi)始
%V - 本年第幾周的 ISO 8601:1988 格式,范圍從 01 到 53,第 1 周是本年第一個(gè)至少還有 4 天的星期,星期一作為每周的第一天。(用 %G 或者 %g 作為指定時(shí)間戳相應周數的年份組成。)
%W - 本年的第幾周數,從第一周的第一個(gè)星期一作為第一天開(kāi)始
%w - 星期中的第幾天,星期天為 0
%x - 當前區域首選的時(shí)間表示法,不包括時(shí)間
%X - 當前區域首選的時(shí)間表示法,不包括日期
%y - 沒(méi)有世紀數的十進(jìn)制年份(范圍從 00 到 99)
%Y - 包括世紀數的十進(jìn)制年份
%Z 或 %z - 時(shí)區名或縮寫(xiě)
%% - 文字上的 `%' 字符

 

?
1
2
3
4
5
6
<{$smarty.now|date_format}><br>
<{$smarty.now|date_format:"%D"}><br>
output:
Mar 25, 2017
03/25/17

 

default[默認值]

  為變量設置一個(gè)默認值。當變量未設置或為空字符串時(shí),將由給定的默認值替代其輸出

?
1
2
3
4
5
6
7
<{$articleTitle|default:'a'}><br>
<{$articleTitle="next x-men film, x3, delayed."}>
<{$articleTitle|default:'a'}><br>
output:
a
next x-men film, x3, delayed.

 

escape[轉義]

  escape作用于變量,用以html、url、單引號、十六進(jìn)制、十六進(jìn)制實(shí)體、javascript、郵件的轉碼或轉義。第一個(gè)參數默認為'html',可選參數有'html,htmlall,url,quotes,hex,hexentity,javascript';第二個(gè)參數默認為'utf-8',可選參數有'ISO-8859-1,UTF-8'...

?
1
2
3
4
5
6
7
<{$articleTitle="'Stiff Opposition Expected to Casketless Funeral Plan'"}>
<{$articleTitle|escape}><br>
<{$articleTitle|escape:'url'}>
output:
'Stiff Opposition Expected to Casketless Funeral Plan'
%27Stiff%20Opposition%20Expected%20to%20Casketless%20Funeral%20Plan%27

indent[縮進(jìn)]

  在每行縮進(jìn)字符串,默認是4個(gè)字符。對于第一個(gè)可選參數,可以指定縮進(jìn)字符數,對于第二個(gè)可選參數,可以指定使用什么字符縮進(jìn),例如'\t'作為tab

?
1
2
3
4
5
6
7
<{$articleTitle="'Stiff Opposition Expected to Casketless Funeral Plan'"}>
<{$articleTitle}><br>
<{$articleTitle|indent}>
output:
'Stiff Opposition Expected to Casketless Funeral Plan'
    'Stiff Opposition Expected to Casketless Funeral Plan'

 

nl2br[換行符替換成<br />]

  所有的換行符將被替換成 <br />,功能同PHP中的nl2br()函數一樣

?
1
2
3
4
5
6
7
8
<{$articleTitle="Next x-men\nfilm, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|nl2br}><br>
output:
Next x-men film, x3, delayed.
Next x-men
film, x3, delayed.

 

regex_replace[正則替換]

  使用正則表達式在變量中搜索和替換,語(yǔ)法來(lái)自php的preg_replace()函數

?
1
2
3
4
5
6
7
8
<{$articleTitle="Next x-men\nfilm, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|regex_replace:"/[\r\t\n]/":" "}><br>
output:
Next x-men
film, x3, delayed.
Next x-men film, x3, delayed.

replace[替換]

  一種在變量中進(jìn)行簡(jiǎn)單的搜索和替換字符串的處理。等同于php的str_replace()函數

?
1
2
3
4
5
6
7
<{$articleTitle="Next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|replace:"x":"y"}><br>
output:
Next x-men film, x3, delayed.
Neyt y-men film, y3, delayed.

 

spacify[插空]

  插空是一種在變量的字符串的每個(gè)字符之間插入空格或者其他的字符(串)的方法

?
1
2
3
4
5
6
7
8
9
<{$articleTitle="Next x-men film, x3, delayed."}>
<{$articleTitle}><br>
<{$articleTitle|spacify}><br>
<{$articleTitle|spacify:"^"}><br>
output:
Next x-men film, x3, delayed.
N e x t x - m e n f i l m , x 3 , d e l a y e d .
N^e^x^t^ ^x^-^m^e^n^ ^f^i^l^m^,^ ^x^3^,^ ^d^e^l^a^y^e^d^.

 

string_format[字符串格式化]

  一種格式化字符串的方法,例如格式化為十進(jìn)制數等等。實(shí)際運用的是php的sprintf()函數

?
1
2
3
4
5
6
7
8
9
<{$number=23.5678}>
<{$number}><br>
<{$number|string_format:"%.2f"}><br>
<{$number|string_format:"%d"}>
output:
23.5678
23.57
23

 

strip[去除(多余空格)]

  用一個(gè)空格或一個(gè)給定字符替換所有重復空格、換行和制表符

<{$articleTitle="Grandmother of\neight makes\t    hole in one."}>
<{$articleTitle}><br>
<{$articleTitle|strip}><br>
<{$articleTitle|strip:' '}><br>

output:
Grandmother of
eight makes        hole in one.
Grandmother of eight makes hole in one.
Grandmother of eight makes hole in one.

strip_tags[去除html標簽]

  去除<和>標簽,包括在<和>之間的全部?jì)热?/p>

?
1
2
3
4
5
6
7
<{$articleTitle="Blind Woman Gets New Kidney from Dad she Hasn't Seen in <b>years</b>."}>
<{$articleTitle}><br>
<{$articleTitle|strip_tags}><br>
output:
Blind Woman Gets New Kidney from Dad she Hasn't Seen in <b>years</b>.<br>
Blind Woman Gets New Kidney from Dad she Hasn't Seen in  years .<br>

 

truncate[截取]

  從字符串開(kāi)始處截取某長(cháng)度的字符,默認是80個(gè),也可以指定第二個(gè)參數作為追加在截取字符串后面的文本串。該追加字串被計算在截取長(cháng)度中。默認情況下,smarty會(huì )截取到一個(gè)詞的末尾。如果想要精確的截取多少個(gè)字符,把第三個(gè)參數改為"true";第四個(gè)參數默認設置為FALSE,表示將截取至字符串末尾,設置為T(mén)RUE則截取到中間。注意如果設了TRUE,則忽略字符邊界

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<{$articleTitle='Two Sisters Reunite after Eighteen Years at Checkout Counter.'}>
<{$articleTitle}><br>
<{$articleTitle|truncate}><br>
<{$articleTitle|truncate:30}><br>
<{$articleTitle|truncate:30:""}><br>
<{$articleTitle|truncate:30:"---"}><br>
<{$articleTitle|truncate:30:"":true}><br>
<{$articleTitle|truncate:30:"...":true}><br>
<{$articleTitle|truncate:30:'..':true:true}><br>
output:
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after...
Two Sisters Reunite after
Two Sisters Reunite after---
Two Sisters Reunite after Eigh
Two Sisters Reunite after E...
Two Sisters Re..ckout Counter.

 wordwrap[行寬約束]

  可以指定段落的列寬(也就是一行多少個(gè)字符,超過(guò)這個(gè)字符數換行),默認80。第二個(gè)參數可選,指定在約束點(diǎn)使用什么換行符,默認為"\n"。默認情況下smarty將截取到詞尾,如果想精確到設定長(cháng)度的字符,請將第三個(gè)參數設為ture。本調節器等同于php的wordwrap()函數

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<{$articleTitle="Blind woman gets new kidney from dad she hasn't seen in years."}>
<{$articleTitle}><br>
<{$articleTitle|wordwrap:30}><br>
<{$articleTitle|wordwrap:20}><br>
<{$articleTitle|wordwrap:30:"<br />\n"}><br>
<{$articleTitle|wordwrap:26:"\n":true}><br>
output:
Blind woman gets new kidney from dad she hasn't seen in years.<br>
Blind woman gets new kidney
from dad she hasn't seen in
years.<br>
Blind woman gets new
kidney from dad she
hasn't seen in
years.<br>
Blind woman gets new kidney<br />
from dad she hasn't seen in<br />
years.<br>
Blind woman gets new
kidney from dad she hasn't
seen in years.<br>

 

內置函數

{$var=...} 變量賦值

  這是{assign}函數的簡(jiǎn)寫(xiě)版,可以直接賦值給模版,也可以為數組元素賦值

?
1
2
3
4
<{$name='Bob'}>The value of $name is <{$name}>.
output:
The value of $name is Bob.

 

{append} 追加

  {append}用于在模板執行期間建立或追加模板變量數組

?
1
2
3
4
5
6
7
8
9
10
11
<{append var='name' value='Bob' index='first'}>
<{append var='name' value='Meyer' index='last'}>
<{* 或者 *}>
<{append 'name' 'Bob' index='first'}> <{* 簡(jiǎn)寫(xiě) *}>
<{append 'name' 'Meyer' index='last'}> <{* 簡(jiǎn)寫(xiě) *}>
The first name is <{$name.first}>.<br>
The last name is <{$name.last}>.
output:
The first name is Bob.The last name is Meyer.

 

{assign} 賦值

  {assign}用來(lái)在模板運行時(shí)為模板變量賦值

<{assign var="name" value="Bob"}>
<{assign "name" "Bob"}> 
<{* 簡(jiǎn)寫(xiě) *}>
The value of $name is <{$name}>. 

output:
The value of $name is Bob.

{config_load}

  {config_load}用來(lái)從配置文件中加載config變量(#variables#)到模版

foo.conf:

[a]
x=1

[b]
x=2

[c]
x=3

<!-- main.tpl -->
<{config_load file='foo.conf' section="a"}>
<{#x#}>

output:
1

{for} 循環(huán)

  {for}、{forelse}標簽用來(lái)創(chuàng )建一個(gè)簡(jiǎn)單循環(huán),支持以下不同的格式:

  {for $var=$start to $end}步長(cháng)為1的簡(jiǎn)單循環(huán);

  {for $var=$start to $end step $step}其它步長(cháng)循環(huán)

  當循環(huán)無(wú)迭代時(shí)執行{forelse}

<ul>
<{for $foo=1 to 3}>    
<li><{$foo}></li><{/for}>
</ul>  

output:
<ul>    
    <li>1</li>
    <li>2</li>
    <li>3</li>
</ul>
<ul>
<{for $foo=2 to 10 max=3}>    
<li><{$foo}></li><{/for}>
</ul>  

output:
<ul>    
    <li>2</li>
    <li>3</li>
    <li>4</li>
</ul>

{while}循環(huán)

  隨著(zhù)一些特性加入到模版引擎,Smarty的{while}循環(huán)與php的while語(yǔ)句一樣富有彈性。每一個(gè){while}必須與一個(gè){/while}成對出現,所有php條件和函數在它身上同樣適用,諸如||、or、&&、and、is_array()等等

  下面是一串有效的限定符,它們的左右必須用空格分隔開(kāi),注意列出的清單中方括號是可選的,在適用情況下使用相應的等號(全等或不全等)

{while $foo > 0}
  {$foo--}
{/while}

{foreach},{foreachelse}遍歷

  {foreach}用來(lái)遍歷數據數組,{foreach}與{section}循環(huán)相比更簡(jiǎn)單、語(yǔ)法更干凈,也可以用來(lái)遍歷關(guān)聯(lián)數組

{foreach $arrayvar as $itemvar}
{foreach $arrayvar as $keyvar=>$itemvar} 

  {foreach}循環(huán)可以嵌套;數組變量通常是(另)一個(gè)數組的值,用來(lái)指導循環(huán)的次數,可以為專(zhuān)有循環(huán)傳遞一個(gè)整數;當數組變量無(wú)值時(shí)執行{foreachelse};

  {foreach}的屬性是@index、@iteration、@first、@last、@show、@total;

  可以用循環(huán)項目中的當前鍵({$item@key})代替鍵值變量

<{$myColors['a'] = 'red'}>
<{$myColors['b'] = 'green'}>
<{$myColors['c'] = 'blue'}>
<ul>
    <{foreach $myColors as $color}>    
        <li><{$color@key}>:<{$color}></li>
    <{/foreach}>
</ul>  

output:
<ul>
        <li>a:red</li>
        <li>b:green</li>
        <li>c:blue</li>    
</ul>  

  @index:包含當前數組的下標,開(kāi)始時(shí)為0

  @iteration:包含當前循環(huán)的迭代,總是以1開(kāi)始,這點(diǎn)與index不同。每迭代一次值自動(dòng)加1

  @first:當{foreach}循環(huán)第一個(gè)時(shí)first為真

  @last:當{foreach}迭代到最后時(shí)last為真

  @show:檢測{foreach}循環(huán)是否無(wú)數據顯示,show是個(gè)布爾值(true or false)

  @total:包含{foreach}循環(huán)的總數(整數),可以用在{forach}里面或后面

  {break}:停止/終止數組迭代

  {continue}:中止當前迭代而開(kāi)始下一個(gè)迭代/循環(huán)

<{$myColors['a'] = 'red'}>
<{$myColors['b'] = 'green'}>
<{$myColors['c'] = 'blue'}>
<{$myColors['d'] = 'pink'}>
<{$myColors['e'] = 'yellow'}>
<ul>
    <{foreach $myColors as $color}> 
        <{if $color@first}>
            <li><b><{$color@iteration}>:<{$color@index}>:<{$color@key}>:<{$color}></b></li>
        <{elseif $color@last}>
            <li><b><{$color@iteration}>:<{$color@index}>:<{$color@key}>:<{$color}></b></li>
        <{else}>
            <li><{$color@iteration}>:<{$color@index}>:<{$color@key}>:<{$color}></li>
        <{/if}>
    <{foreachelse}>
        no result...    
    <{/foreach}>
</ul>  

output:
<ul>
    <li><b>1:0:a:red</b></li>
    <li>2:1:b:green</li>
    <li>3:2:c:blue</li>
    <li>4:3:d:pink</li>
    <li><b>5:4:e:yellow</b></li>        
</ul>  

{if}{elseif}{else} 條件

隨著(zhù)一些特性加入到模版引擎,Smarty的{if}語(yǔ)句與php的if語(yǔ)句一樣富有彈性。每一個(gè){if}必須與一個(gè){/if}成對出現,允許使用{else}和{elseif},所有php條件和函數在這里同樣適用,諸如||、or、&&、and、is_array()等等

?
1
<{if $name == 'Fred' || $name == 'Wilma'}><br> ... <br><{/if}> <br><{* 允許使用圓括號 *}> <br><{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}> <br>... <br><{/if}> <br><{* 可以嵌入函數 *}><br> <{if count($var) gt 0}> <br>... <br><{/if}> <br><{* 數組檢查 *}> <br><{if is_array($foo) }> <br>..... <br><{/if}> <br><{* 是否空值檢查 *}> <br><{if isset($foo) }> <br>..... <br><{/if}> <br><{* 測試值為偶數還是奇數 *}> <br><{if $var is even}> <br>... <br><{/if}> <br><{if $var is odd}> <br>... <br><{/if}> <br><{if $var is not odd}> <br>... <br><{/if}> <br><{* 測試var能否被4整除 *}> <br><{if $var is div by 4}> <br>... <br><{/if}> <br><{* 測試發(fā)現var是偶數,2個(gè)為一組,也就是0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, 等等 *}> <br><{if $var is even by 2}> <br>... <br><{/if}> <br><{* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *}> <br><{if $var is even by 3}> <br>... <br><{/if}>

 {include}

  {include}標簽用于在當前模板中包含其它模板。當前模板中的任何有效變量在被包含模板中同樣可用

  必須指定file屬性,該屬性指明模板資源的位置

  變量可以作為屬性參數傳遞給被包含模板,任何明確傳遞給被包含模板的變量只在被包含文件的作用域中有效。如果傳遞的屬性變量在當前模板中有同名變量,那么傳遞的屬性變量將覆蓋當前模板變量

?
1
2
3
4
5
6
7
8
9
10
11
<!-- main.tpl -->
<{include file="header.tpl" test="小火柴"}>
<!-- header.tpl -->
<{$test}>
<{$test="aaa"}><br>
<{$test}>
output:
小火柴
aaa

 {function}

  {function}用來(lái)在模板中創(chuàng )建函數,可以像調用插件函數一樣調用它們

  我們不寫(xiě)一個(gè)表達內容的插件,而是讓它保留在模板中,通常這是個(gè)更易于管理的選擇。同時(shí),它也簡(jiǎn)化了對數據的遍歷,例如深度嵌套菜單。另外可以在模板中直接使用{funcname...}函數。

  {function}標簽必須包含模板函數名的name屬性,該name標簽名必須能夠調用模板函數

  默認變量值應能作為屬性傳遞到模板函數,當模板函數被調用的時(shí)候,默認值應能被復寫(xiě)

  在模板函數內部應能使用被調用模板的所有變量值,在模板函數中更改或新建變量的值必須具局部作用域,而且在執行模板函數后這些變量值在被調用模板內部應不可見(jiàn)

  調用函數時(shí),可以直接使用函數名,或者使用{call}

?
1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- main.tpl -->
<{function name=test a=0 b=0}>
    <{$a}>+<{$b}>=<{$a+$b}>
<{/function}>
<{test}><br>
<{test a=1 b=2}><br>
<{call test a=3 b=3}><br>
output:
0+0=0
1+2=3
3+3=6

 

插件

  Smarty中的插件總是按需加載。只有在模板腳本中調用特定的調節器、函數、資源插件等時(shí)才會(huì )自動(dòng)加載。此外,每個(gè)插件只加載一次,即便在同一個(gè)請求中存在幾個(gè)不同的Smarty實(shí)例同時(shí)運行

  插件目錄可以是一個(gè)包含路徑的字符串或包含多個(gè)路徑的數組。安裝插件的時(shí)候,將插件簡(jiǎn)單地置于其中一個(gè)目錄下,Smarty會(huì )自動(dòng)識別使用

  插件文件和函數必須遵循特定的命名約定以便Smarty識別

  插件文件必須命名如下:

type.name.php 

  其中type為下面這些插件類(lèi)型中的一種: 

function 
modifier 
block 
compiler 
prefilter 
postfilter 
outputfilter 
resource 
insert 

  name為合法標識符,僅包含字母、數字和下劃線(xiàn)

function.html_select_date.php, resource.db.php, modifier.spacify.php

  插件內的函數應遵循如下命名約定

smarty_type_name ()

  如果調節器(modifier)命名為foo,那么按規則函數為smarty_modifier_foo()。如果指定的插件文件不存在或文件、函數命名不合規范,Smarty會(huì )輸出對應的錯誤信息

  Smarty既可自動(dòng)從文件系統加載插件,也可在運行時(shí)通過(guò)register_* API函數注冊插件。當然,也可以通過(guò)unregister_* API函數卸載已經(jīng)載入的插件

  對于只在運行時(shí)注冊的插件函數不必遵守命名約定

如果某個(gè)插件依賴(lài)其它插件的某些功能(事實(shí)上,一些插件被綁定在Smarty中),那么可以通過(guò)如下方法加載需要的插件:

?
1
2
3
<?php
    require_once $smarty->_get_plugin_filepath('function', 'html_options');
?>


  按照慣例,Smarty對象通常作為最后一個(gè)參數傳遞給插件,但有兩個(gè)例外:1、調節器不須接受Smarty對象的傳遞;2、為了向前兼容舊版Smarty,塊插件將$repeat排在Smarty對象后面作為最后一個(gè)參數($smarty作為倒數第二個(gè)參數)

【模板函數】

?
1
2
3
void smarty_function_name($params, $smarty);
array $params;
object $smarty;

 



  模板傳遞給模板函數的所有屬性都包含在關(guān)聯(lián)數組$params中

  在模板中,函數的輸出內容(返回值)在原位置用函數標簽代替,例如{fetch}函數。作為另一種選擇,函數也可以單純地用來(lái)做些非輸出內容的任務(wù),如{assign}函數

  如果函數需要分配(俗話(huà)說(shuō)的賦值)一些變量給模板或者使用Smarty提供的一些函數,可以通過(guò)$smarty對象實(shí)現,如$smarty->foo()

?
1
2
3
4
5
6
7
8
9
10
11
12
//function.eightball.php
<?php
function smarty_function_eightball($params, $smarty){   
    $answers = array('Yes', 'No','No way','Outlook not so good','Ask again soon','Maybe in your reality');
    $result = array_rand($answers);
    return $answers[$result];}
?>
<!-- main.tpl -->
Question: Will we ever have time travel?<br>
Answer: <{eightball}>.

 
  除了使用以上方式,還可以使用registerPlugin()方式來(lái)進(jìn)行插件注冊,但是由于與PHP代碼混合在一起,不建議使用

registerPlugin()

  void registerPlugin(string type, string name, mixed callback, bool cacheable, mixed cache_attrs);

  registerPlugin()方法在腳本中注冊函數或方法作為插件。其參數如下:

  “type”定義插件的類(lèi)型,其值為下列之一:“function”、“block”、“compiler”和“modifier”

  “name”定義插件的函數名

  “callback”為定義的php回調函數,其類(lèi)型為下列之一:

  1、包含函數名的字符串;

  2、格式為(&$object, $method)的數組,其中,&$object為引用對象,$method為包含方法名的字符串;

  3、格式為($class, $method)的數組,其中,$class為類(lèi)名,$method為類(lèi)中的方法。

  “cacheable”和“cache_attrs”參數大多情況下可以省略

<?php 
header("content-type:text/html;charset=utf-8");
require './init.inc.php';
function eightball($params, $smarty){    
    $answers = array('Yes', 'No','No way','Outlook not so good','Ask again soon','Maybe in your reality');
    $result = array_rand($answers);
    return $answers[$result];
}
$smarty -> registerPlugin('function', 'test', 'eightball');
$smarty -> display('main.tpl');
?>
<!-- main.tpl -->
Question: Will we ever have time travel?<br>
Answer: <{test}>. <br>

【調節器】

  調節器是一些簡(jiǎn)短的函數,這些函數被應用于顯示模板前作用于一個(gè)變量,或者其它情形中。調節器可以連接起來(lái)(執行)

mixed smarty_modifier_name($value, $param1);
mixed $value;
[mixed $param1, ...];

  調節器插件的第一個(gè)參數應該直接了當地聲明處理什么類(lèi)型(可以是字符串、數組、對象等等這些類(lèi)型)。其它的參數是可選的,取決于執行的操作類(lèi)型。調節器必須返回處理結果

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//modifier.u.php
<?php
function smarty_modifier_u($str){   
    return ucwords($str);
}
?>
<!-- main.tpl -->
<{$testValue = 'Question: Will we ever have time travel?' }><br>
<{$testValue}><br>
<{$testValue|u}><br>
output:
Question: Will we ever have time travel?
Question: Will We Ever Have Time Travel?

 【塊函數】

?
1
2
3
4
5
void smarty_block_name($params, $content, $smarty, &$repeat);
array $params;
mixed $content;
object $smarty;
boolean &$repeat;

 

  塊函數的形式是這樣的:{func} .. {/func}。換句話(huà)說(shuō),他們被封閉在一個(gè)模板區域內,然后對該區域的內容進(jìn)行操作。塊函數優(yōu)先于同名的自定義函數,換句話(huà)說(shuō),不能同時(shí)使用自定義函數{func}和塊函數{func} .. {/func}。

  默認地,函數實(shí)現會(huì )被Smarty調用兩次:一次是在開(kāi)始標簽,另一次是在閉合標簽

  從Smarty3.1開(kāi)始打開(kāi)標簽回調(函數)的返回值同樣會(huì )被顯示

  只有塊函數的開(kāi)始標簽具有屬性。所有屬性包含在作為關(guān)聯(lián)數組的$params變量中,經(jīng)由模板傳遞給模板函數。當處理閉合標簽時(shí),函數同樣可訪(fǎng)問(wèn)開(kāi)始標簽的屬性

  $content變量值取決于函數是被開(kāi)始標簽調用還是被閉合標簽調用。假如是開(kāi)始標簽,變量值將為NULL,如果是閉合標簽,$content變量值為模板塊的內容。請注意這時(shí)模板塊已經(jīng)被Smarty處理過(guò),因此所接收到的是模板的輸出而不是模板資源

  &$repeat參數通過(guò)引用傳遞給函數執行,并為其提供控制塊顯示多少次的可能性。默認情況下,在首次調用塊函數(塊開(kāi)始標簽)時(shí),&$repeat變量為true,在隨后的所有塊函數(閉合標簽)調用中其值始終為false。函數每次執行返回的&$repeat值為true時(shí),{func} .. {/func}之間的內容會(huì )被求值,同時(shí)參數$content里的新塊內容會(huì )再次調用執行函數

  如果嵌套了塊函數,可以通過(guò)$smarty->_tag_stack變量訪(fǎng)問(wèn)找出父塊函數。只須對塊函數運行一下var_dump(),函數結構就可以一目了然了

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//block.s.php
<?php
function smarty_block_s($params, $content, $smarty, &$repeat){
    return substr($content,0,$params['num']+1);
}
?>
<!-- main.tpl -->
<{$testValue = 'Question: Will we ever have time travel?' }><br>
<{$testValue}><br>
<{s num="5"}>
<{$testValue}>
<{/s}>
output:
Question: Will we ever have time travel?
Quest

 

模板繼承

  繼承帶來(lái)了模板面向對象概念(oop),它允許定義一個(gè)或多個(gè)基模板供子模板繼承。繼承意味著(zhù)子模板可覆蓋所有或部份父模板中命名相同的塊區域

  模板繼承是一種編譯時(shí)進(jìn)程,其將建立一個(gè)獨立的編譯模板文件。與對應的基于載入{include}子模板解決方案相比,當解釋模板時(shí),前者有更好的性能

{extends} 繼承

  {extends}標簽用在模板繼承中子模版對父模板的繼承

  {extends}標簽用在模版中的第一行

  如果子模板用{extends}標簽繼承父模板,那么它只能包含{block}標簽(內容),其它任何模板內容都將忽略

  使用此語(yǔ)法為模板資源繼承$template_dir目錄外的文件

{extends file='parent.tpl'}
{extends 'parent.tpl'}  {* short-hand *}
<!-- parent.tpl-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    我是父模板中的文字    
</body>
</html>

<!-- child.tpl-->
<{extends 'parent.tpl'}>
<!-- parent.php-->
<?php 
header("content-type:text/html;charset=utf-8");
require './init.inc.php';
$smarty -> display('parent.tpl');
?>

<!-- child.php-->
<?php 
header("content-type:text/html;charset=utf-8");
require './init.inc.php';
$smarty -> display('child.tpl');
?>

 {block} 塊

  {block}用來(lái)給模板繼承定義一個(gè)模板資源的命名區域。子模板的{block}資源區域將會(huì )取代父模板中的相應區域。{block}可以嵌套

  任意的子、父模板{block}區域可以彼此結合??梢酝ㄟ^(guò)子{block}定義使用append、prepend選項標記追加或預置父{block}內容。使用{$smarty.block.parent}可將父模板的{block}內容插入至子{block}內容中的任何位置。使用{$smarty.block.child}可將子模板{block}內容插入至父{block}內容中的任何位置

  [注意]子模板不能定義任何內容,除了需要覆蓋父模板的{block}標簽塊,所有在{block}標簽外的內容將被自動(dòng)移除

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!-- parent.tpl-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<{block name="one"}>
    one
<{/block}><br>
<{block name="two"}>
    two
<{/block}><br>
<{block name="three"}>
    three
<{/block}><br>
<{block name="four"}>
    four <{$smarty.block.child}>
<{/block}><br>
<{block name="five"}>
    five
<{/block}><br>
</body>
</html>

 



?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!-- child.tpl-->
<{extends 'parent.tpl'}>
<{block name="one"}>
    1
<{/block}><br>
<{block name="two" prepend}>
    2
<{/block}><br>
<{block name="three" append}>
    3
<{/block}><br>
<{block name="four"}>
    4
<{/block}><br>
<{block name="five"}>
    5 <{$smarty.block.parent}>
<{/block}><br>
block區域之外的內容不會(huì )顯示

 

?
1
2
3
4
5
6
7
8
9
10
11
12
<!-- parent.php-->
<?php
header("content-type:text/html;charset=utf-8");
require './init.inc.php';
$smarty -> display('parent.tpl');
?>
<!-- child.php-->
<?php
header("content-type:text/html;charset=utf-8");
require './init.inc.php';
$smarty -> display("child.tpl");
?>

 

 

 

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
PHP地址引用是會(huì )修改所引用變量的值的
php 三級分類(lèi)(非遞歸),怎么從數據庫中取出?怎么smarty...
模板引擎smarty 3中的變化
smarty --foreach詳解 - 日志 - tomore - 問(wèn)友源碼空間
Crash Course
用smarty_block函數實(shí)現不緩存
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久