?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
Smarty - the compiling PHP template engine | ||
---|---|---|
Prev 來源:PHP中文社區(qū) | Next |
Smarty has several different types of variables.
The type of the variable depends on what symbol it is prefixed with (or enclosed
within).
Smarty有幾種不同類型的變量.
變量 的類型取決于它的前綴是什么符號(或者被什么符號包圍)
Variables in Smarty can be either displayed directly or used as arguments for
function attributes and modifiers, inside conditional expressions, etc.
To print a variable, simply enclose it in the delimiters so that it is the
only thing contained between them. Examples:
Smarty的變量可以直接被輸出或者作為函數(shù)屬性和修飾符(modifiers)的參數(shù),或者用于內(nèi)部的條件表達(dá)式等等.
如果要輸出一個變量,只要用定界符將它括起來就可以.例如:
{$Name} {$Contacts[row].Phone} <body bgcolor="{#bgcolor#}"> |
Variables that are assigned from PHP are referenced by preceding them with a
dollar sign $.
Variables assigned from within the template with the assign function are also displayed this way.
調(diào)用從PHP分配的變量需在前加"$"符號.(譯注:同php一樣)
調(diào)用模板內(nèi)的assign函數(shù)分配的變量也是這樣.(譯注:也是用$加變量名來調(diào)用)
Example 4-1. assigned variables
|
Prev 來源:PHP中文社區(qū) | Home | Next |
Attributes [屬性] |
Up | Associative arrays [關(guān)聯(lián)數(shù)組] |