开发者

Use specific layout for a model

开发者 https://www.devze.com 2022-12-14 12:18 出处:网络
Can anyone tell me how can I define and use a specific layou开发者_开发技巧t for a model (not a template)? I would like to do this for my custom 404 error page.As Peter Bailey commented above, your la

Can anyone tell me how can I define and use a specific layou开发者_开发技巧t for a model (not a template)? I would like to do this for my custom 404 error page.


As Peter Bailey commented above, your layout is a component of the view and has nothing to do with models. Therefore you'd be able to do something like this in the actions module you're using (normally default):

public function executeError404(sfWebRequest $request)
{
  $this->setLayout("your_layout_name");

  // ...
}

and then in your [APPNAME]/templates directory, create the your_layout_name.php template file as you would with any other template.

0

精彩评论

暂无评论...
验证码 换一张
取 消