Use specific layout for a model
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.
精彩评论