Skip to content

Instantly share code, notes, and snippets.

@caironoleto
Created November 5, 2008 13:12
Show Gist options
  • Save caironoleto/22328 to your computer and use it in GitHub Desktop.
Save caironoleto/22328 to your computer and use it in GitHub Desktop.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Loader extends CI_Loader {
public $layout = "application";
function MY_Loader() {
parent::CI_Loader();
}
function setLayout($layout) {
$this->layout = $layout;
}
public function view($view, $data = null, $return = false) {
if ($this->layout == 'none')
$this->partial($view, $data, $return);
else {
$resultData['layoutContent'] = parent::view($view, $data, true);
return parent::view('layouts/' . $this->layout, $resultData, $return);
}
}
public function partial($view, $data = null, $return = false) {
return parent::view($view, $data, $return);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment