日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php $smarty-display,display - [ smarty完全中文手册 ] - 在线原生手册 - php中文网

發布時間:2023/12/14 php 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php $smarty-display,display - [ smarty完全中文手册 ] - 在线原生手册 - php中文网 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

display

顯示

void display(string

template [, string cache_id [, string compile_id]])

This displays the template. Supply a valid template resource type and path. As

an optional second parameter, you can pass a cache id. See the caching section for more information.

顯示模板,需要指定一個合法的模板資源的類型和路徑。你還可以通過

第二個可選參數指定一個緩存號,相關的信息可以查看緩存。

As an optional third parameter, you can pass a compile id. This is

in the event that you want to compile different versions of the same

template, such as having separate templates compiled for different

languages. Another use for compile_id is when you use more than one

$template_dir but only one $compile_dir. Set a separate compile_id for

each $template_dir, otherwise templates of the same name will overwrite

each other. You can also set the $compile_id

variable once instead of passing this to each call to display().

通過第三個可選參數,可以指定一個編譯號。這在你想把一個模板編譯成不同版本時使用,比如針對不同的語言編譯模板。編譯號的另外一個作用是,如果你

有多個$template_dir模板目錄,但只有一個$compile_dir編譯后存檔目錄,這時可以為每一個$template_dir模板目錄指

定一個編譯號,以避免相同的模板文件在編譯后會互相覆蓋。相對于在每一次調用display()的時候都指定編譯號,也可以通過設置$compile_id編譯號屬性來一次性設定。

Example 13-12. display

例子 13-12. 顯示

include("Smarty.class.php");

$smarty = new Smarty;

$smarty->caching = true;

// only do db calls if cache doesn't exist

// 只有在緩存不存在時才調用數據庫

if(!$smarty->is_cached("index.tpl"))

{

// dummy up some data

$address = "245 N 50th";

$db_data = array(

"City" => "Lincoln",

"State" => "Nebraska",

"Zip" = > "68502"

);

$smarty->assign("Name","Fred");

$smarty->assign("Address",$address);

$smarty->assign($db_data);

}

// display the output

// 顯示輸出

$smarty->display("index.tpl");

Use the syntax for template

resources to display files outside of the $template_dir directory.

通過模板資源的語法來使用不在$template_dir模板目錄

下的文件。

Example 13-13. function display template resource examples

例子 13-13. 顯示模板資源

// absolute filepath

// 絕對路徑

$smarty->display("/usr/local/include/templates/header.tpl");

// absolute filepath (same thing)

// 絕對路徑(另外一種方式)

$smarty->display("file:/usr/local/include/templates/header.tpl");

// windows absolute filepath (MUST use "file:" prefix)

// WINDOS平臺下的絕對路徑(必須使用“file:”前綴)

$smarty->display("file:C:/www/pub/templates/header.tpl");

// include from template resource named "db"

// 從模板資源“db“中調用

$smarty->display("db:header.tpl");

總結

以上是生活随笔為你收集整理的php $smarty-display,display - [ smarty完全中文手册 ] - 在线原生手册 - php中文网的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。