loadLayout Method

This loadLayout method will be loaded a layout file or view component that file relatives in current theme into view buffer.

Basic Usage

Here is the basic usage of loadLayout method.

$this->loadLayout(string $layout [, array $data = array()]): $this


This method has 1 required parameter and 1 optional parameter.


The $layout value is string name of a file relatives to current theme.

Layout Requirements

The valid layout should only put inside page directory of the current theme.

└── view/
    └── page/
      └── [LAYOUT_FILENAME].php


Here is the example for loadLayout method:

class Blog extends SENE_Controller {
  public function __construct(){
  public function index(){
    $data = array();
    $data['example'] = 'this is example';
    $this->setTitle('Blog home');

So, the front theme and col-1 layout should be existed on the directory structure.

└── view/
  └── front/
    └── page/
      └── col-1.php


The putThemeContent, putJsContent, and render method(s) has ability for buffered the html view.

Layout Naming Tips

If you confused how to decided the name of a layout, here is the tips with its filename:

  • col-1.php is for a page with one column.
  • col-2-left.php is for a page splitted by two column, and the menu are on left.
  • col-2-right.php is for a page splitted by two column, and the menu are on right.
  • col-3.php is for a page splitted by three column.
  • login.php the special layout for login.
  • homepage.php the special layout for homepage.