Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
- class Layout {
- private $obj;
- private $layout;
- function Layout($layout = 'layout_main') {
- $this->obj =& get_instance();
- $this->layout = 'layouts/' .$layout;
- }
- public function setLayout($layout) {
- $this->layout = 'layouts/' .$layout;
- }
- public function view ($view, $data = null, $return = false) {
- $data['yield'] = $this->obj->load->view($view, $data, true);
- if ($return == true) {
- $output = $this->obj->load->view($this->layout, $data, true);
- return $output;
- }
- else {
- $this->obj->load->view($this->layout,$data, false);
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment