* アクションの作成 [#p1a77b9b]
** アクションの作成 [#b9370f0f]
showアクションを作成。URLは http://localhost/frontend_dev.php/goods/show になる。
- actions/actions.class.php
<?php
class goodsActions extends sfActions
{
public function executeShow()
{
$this->mesg = 'SHOW!';
}
}
- goods/templates/showSuccess.php
<html>
<body>
<?php if ($mesg): ?>
[<?php echo $mesg ?>]
<?php endif; ?>
</body>
</html>
*** アクションからテンプレートに値を渡す [#o5502374]
- アクション
public function executeIndex()
{
$this->setVar('foo', 'bar');
$this->foo = 'bar';
}
- テンプレート
<html><body>
<?php echo $foo ?> <?php echo $bar ?>
</body></html>
*** アクションでテンプレートを指定する [#e7169d8b]
public function executeIndex()
{
$this->setTemplate('foo');
}
apps/frontend/modules/XXX/templates/fooSuccess.php が呼ばれる。