How to create layout that use header and footer partials

I have red the guide about views and layouts, I have googled how to to this, but I still can not make it work. Here is the problem:

I want to have 2column.php and 3column.php layouts, where both are using _header.php and _footer.php partials.

2columns.php layout example:

render _header.php

$content and some other extra code

render _footer.php

Whatever I do I can not make it work. Can someone please post me real simple example of how to achieve this ? Thanks

Hi!

Do you receive any errors? …

As far as I understood it should work like in any view file.

Lets say you have your header and footer in path:

@app/views/layouts/_header.php

@app/views/layouts/_footer.php

Then you can simply do:

@app/views/layouts/main.php




echo $this->render('_header');


echo $content; 


echo $this->render('_footer');



And then just tell your app which layout to use.

For example in a controller:




public $layout='/main'



That should work.

Regards