The reserved {$smarty} variable can be used to access several special template variables. The full list of them follows.
保留的 {$smarty} 變數可以用來取得某些相當特殊的樣版變數,這些變數的說明如 下。
The request variables such as get, post, cookies, server, environment, and session variables can be accessed as demonstrated in the examples below:
要求變數如 get, post, cookies, server, environment 與 session 等變數取 得方式如下:
Note: For historical reasons {$SCRIPT_NAME} can be accessed directly though {$smarty.server.SCRIPT_NAME} is the proposed way to access this value.
提醒: 因為使用習慣的原因,我們建議使用 {$smarty.server.SCRIPT_NAME} 變數取得 {$SCRIPT_NAME} 的值。
The current timestamp can be accessed with {$smarty.now}. The number reflects the number of seconds passed since the so-called Epoch (January 1, 1970) and can be passed directly to date_format modifier for display purposes.
我們可以使用 {$smarty.now} 取得現在的時間戳記,得到的數字代表從1970 年1月1日開始到現在的秒數,我們可以將得到的數字傳給 date_format 修飾字。
The output captured via {capture}..{/capture} construct can be accessed using {$smarty} variable. See section on capture for an example.
由 {capture}..{/capture} 獲得的輸出變數可以使用 {$smarty} 取得,範例 請參閱 capture。
{$smarty} variable can be used to refer to loaded config variables. {$smarty.config.foo} is a synonym for {#foo#}. See the section on config_load for an example.
{$smarty} 變數可以用來參照到已載入的組態變數,如 {$smarty.config.foo} 同義於 {#foo#},範例請參閱 config_load。
{$smarty} variable can be used to refer to 'section' and 'foreach' loop properties. See docs for section and foreach.
{$smarty} 變數可以用來參照到 'section' 與 'foreach' 等遞迴屬性,請參 閱 section 與 foreach 文件。
This variable contains the name of the current template being processed.
此參數內容為現在正在處理的樣版名稱。
This variable contains the version of Smarty the template was compiled with.
此參數內容為 Smarty 的版本數字。
This variable is used for printing the left-delimiter value literally. See also {ldelim},{rdelim}.
此變數用來列印出左阻斷符號,請參閱 {ldelim},{rdelim}。
This variable is used for printing the right-delimiter value literally. See also {ldelim},{rdelim}.
此變數用來列印出右阻斷符號,請參閱 {ldelim},{rdelim}。