How to set the layout from a view

1
Dec
0

A few minutes ago I came across a blog post by Jeremy Burns where he describes how to render different layouts depending on the controller. Although his solution is correct, there is an even better solution that follows the MVC concept.

You can set the layout inside your view. All you have to do is adding the following code:

<?php
    $this->layout = 'your_layout';
?>

It’s easy, isn’t it?

Filed under: CakePHP
No Comments

No Comments

No comments yet.

Leave a comment

RSS feed for comments on this post