*/ class WB_Controller extends CI_Controller { protected $view = FALSE; public $data = array(); protected $asides = array(); public $theme = FALSE; public $theme_file = "theme"; public $active = NULL; public $sub_active = NULL; public $skin = NULL; public $skin_type = NULL; public function __construct() { parent::__construct(); } public function _remap($method) { if (method_exists($this, $method)) call_user_func_array(array($this, $method), array_slice($this->uri->rsegments, 2)); else { if (method_exists($this, '_404')) call_user_func_array(array($this, '_404'), array($method)); else show_404(strtolower(get_class($this)).'/'.$method); } $this->_load_view(); } protected function _load_view() { if( empty($this->view) ) return; $this->data['skin_url'] = ( $this->skin && $this->skin_type ) ? base_url("views/".DIR_SKIN . '/' . $this->skin_type . '/' . $this->skin . '/') : NULL; $this->data['theme_url'] = (isset($this->theme) && $this->theme != FALSE) ? base_url("views/". DIR_THEME . "/" . $this->theme . "/") : NULL; if( $this->skin && $this->skin_type ) { $view = DIR_SKIN . '/' . $this->skin_type . '/' . $this->skin . '/' . $this->view; } else if ( isset($this->theme) && $this->theme ) { $view = DIR_THEME . '/' . $this->theme . '/' . $this->view; } else { $view = $this->view; } if (!empty($this->asides) && is_array($this->asides)) { foreach ($this->asides as $name => $file) { $file_url = (isset($this->theme) && $this->theme) ? DIR_THEME . '/' . $this->theme .'/' . $file : $file; $this->data['asides_'.$name] = $this->load->view($file_url, $this->data, TRUE); } } $data['contents'] = $this->load->view($view, $this->data, TRUE); if( $this->skin && $this->skin_type ) { $data['contents'] = "