Rui Gonçalves
Rui Gonçalves

Reputation: 2433

Use specific layout for a model

Can anyone tell me how can I define and use a specific layout for a model (not a template)? I would like to do this for my custom 404 error page.

Upvotes: 0

Views: 301

Answers (1)

richsage
richsage

Reputation: 27102

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.

Upvotes: 2

Related Questions