Braindead1.de My personal web home

1Dec/090

How to set the layout from a view

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 Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.