鍍金池/ 教程/ PHP/ Smarty函數(shù)
Smarty安裝
Smarty insert
Smarty 建立緩存
Smarty調(diào)試控制臺
Smarty if,elseif,else
Smarty include_php
Smarty多個緩存
Smarty方法
Smarty section,sectionelse
Smarty注釋代碼
Smarty屬性
Smarty緩沖處理函數(shù)
Smarty變量調(diào)節(jié)器
Smarty函數(shù)
Smarty組合修改器
Smarty雙引號里值的嵌入
Smarty預(yù)過濾器
Smarty foreach,foreachelse
Smarty include
Smarty Caching緩存
Smarty變量
Smarty assign用法
Smarty控制插件輸出緩沖
Smarty從配置文件讀取的變量
Smarty對象
Smarty literal
Smarty緩存集合
Smarty教程
Smarty display方法
Smarty自定義函數(shù)
Smarty配置文件
Smarty擴(kuò)展設(shè)置
Smarty數(shù)學(xué)運算
Smarty輸出濾鏡
Smarty fetch方法

Smarty函數(shù)

函數(shù)

每一個smarty標(biāo)簽輸出一個變量或者調(diào)用某種函數(shù).
在定界符內(nèi) 函數(shù)(用'{'包住)和其屬性(用界符包住)將被處理和輸出.例如: 
{funcname attr1="val" attr2="val"}.

例 3-2.函數(shù)語法

{config_load file="colors.conf"}

{include file="header.tpl"}

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

{include file="footer.tpl"}

 

在模板里無論是內(nèi)建函數(shù)還是自定義函數(shù)都有相同的語法.
內(nèi)建函數(shù)將在smarty內(nèi)部工作,例如 {if} {section} and {strip} .他們不能被修改.
自定義函數(shù)通過插件機制起作用,它們是附加函數(shù). 只要你喜歡,可以隨意修改.你也可以自行添加.
例如 {html_options}  {html_select_date}