- Seme Framework
- Credits
- Version 3.1.5
- Issue
- Deployment
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
Parameters
This method has 1 required parameter and 1 optional parameter.
$layout
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.
app/
└── view/
└── THEME_NAME/
└── page/
└── [LAYOUT_FILENAME].php
Example
Here is the example for loadLayout
method:
<?php
class Blog extends SENE_Controller {
public function __construct(){
parent::__construct();
$this->setTheme('front');
}
public function index(){
$data = array();
$data['example'] = 'this is example';
$this->setTitle('Blog home');
$this->putThemeContent("blog/home",$data);
$this->putJsContent('blog/home_bottom',$data);
$this->loadLayout('col-1',$data);
$this->render();
}
}
So, the front
theme and col-1
layout should be existed on the directory structure.
app/
└── view/
└── front/
└── page/
└── col-1.php