$TextMain = array("Title"=>'用户信息',"User"=>'用户名');$Value = 20;$template = new Template("../templates","keep"); // 建立 Template
$template->set_file("main","main.html"); // 设定test.html为main
$template->set_var("Text",$TextMain);
$template->set_var("Num",$Value);$template->parse("out", "main"); // 将main解析后存入out
$template->p("out"); 在模板里调用一般的变量时: {Num}
但我想在模板中显示,如用户信处这项该如何写,{Text['Title']} {Text.Title} {Title[0]}我都试过了也不行,请使用过phplib的大哥告诉我一下,必定加分
$template->set_file("main","main.html"); // 设定test.html为main
$template->set_var("Text",$TextMain);
$template->set_var("Num",$Value);$template->parse("out", "main"); // 将main解析后存入out
$template->p("out"); 在模板里调用一般的变量时: {Num}
但我想在模板中显示,如用户信处这项该如何写,{Text['Title']} {Text.Title} {Title[0]}我都试过了也不行,请使用过phplib的大哥告诉我一下,必定加分
我不想使用如下方法,我是把语言文本从一个数组时里一起传到模板,而不想一个个的传,在smarty里就可很方便,{$Text.Title}就可以,但phplib 里却不可以
$template->set_var(
array(
"LanguageValue" => $Value[0],
"IsSelected" =>$Value[1],
"LanguageName" => $Value[2]
)
);