2009-02-25

在layout中应用action定义的变量

类归于: symfonyzhuozi @ 13:21

在action中定义变量
// in the action
class ...Actions extends sfActions
{
public function execute...()
{
$this->title = 'foo';
}
}

在template取得变量,再传给layout
// in the template
<?php slot('title', $title) ?>

在layout中,显示变量
// in the layout
<?php echo get_slot('title') ?>

随机日志

2 条评论 »

  1. 领教,谢谢

    Comment 由 leo — 2009-03-20 @ 00:49

  2. eGmiuweus [url=http://tiny.cc/getafreeiphone]Free iPhone 5[/url] Illeonnychjbg

    Comment 由 Ceabfloalge — 2011-11-19 @ 08:11

这篇文章上的评论 RSS feed TrackBack URL

留下评论

WordPress 所驱动