How To Render A Layout

Hi there,

I’m having a problem when trying to render a partial layout. For example my main layout consists of header, body and footer. body is the content. I want to render header file and footer file in main.php. How can I archive that ?

Thanks,

Dong

$this->render / $this->renderPartial

Or you can use widgets for that.

Multiple ways as ORey mentioned.

Alternatively, if you want to have nested & embedded layouts (e.g. different view layout files called header.php, body.php, and footer.php), you can create a master layout (main.php) embedding these sub-layouts like this:




$this->beginContent('@app/views/layouts/header.php');

//header layout content here

$this->endContent();


$this->beginContent('@app/views/layouts/body.php');

//body layout content here

$this->endContent();


$this->beginContent('@app/views/layouts/footer.php');

//footer layout content here

$this->endContent();