Smarty 模板 注册函数

#1 52833

如何在将一段自定义函数注册到模板中

已知

function index(){ // 这里是首页 [table]
[tr][td]05[/td][td]        $guestbook = spClass("guestbook"); [/td][/tr]
[/table]
[table]
[tr][td]06[/td][td]        $this->results = $guestbook->findAll(); // 用$this->results可以将$guestbook->findAll()的值发送到模板上面,模板上可以用$results来使用该值。 [/td][/tr]
[/table]
[table]
[tr][td]07[/td][td]        $this->display("white/index.html"); // 显示模板,这里使用的模板是根目录/tpl/green/index.html。 [/td][/tr]
[/table]
[table]
[tr][td]08[/td][td]    } [/td][/tr]
[/table]

2010-07-05 23:02:37

#2 jake

可以看看此贴

http://speedphp.com/bbs/viewthread.php?tid=115&highlight=addview

2010-07-06 02:20:17

#3 52833

已解决  谢谢热心的jake

2010-07-06 11:41:13