// Construct // --------------------------------------------------------------------------- public function __construct($dingo) { $this->dingo = $dingo; if ($current = config::get('current_theme')) { $this->current = $current; } } // Set // --------------------------------------------------------------------------- public function set($theme) { $this->current = $theme; } // View // --------------------------------------------------------------------------- public function view($view, $data = NULL) { // Try to load view from theme if (file_exists(config::get('application') . "/views/{$this->current}/{$view}.php")) { $this->dingo->load->view("{$this->current}/{$view}", $data); } elseif ($this->current != 'default' and file_exists(config::get('application') . "/views/default/{$view}.php")) { $this->dingo->load->view("default/{$view}", $data); } else { dingo_error(E_USER_WARNING, 'The requested theme view (' . config::get('application') . "/views/{$this->current}/{$view}.php) could not be found."); } } } register::library('theme', new theme($dingo));