Hi guys,
I can use some help with the following:
I'm developing a custom CMS for a client with CI 3 and HMVC.
What I really want to achieve, is that I can load views outside the normal view or module/view folders. This because I want to give the client the opportunity to choose a theme for a certain page, so that I can load out of the root/themes/chosen_theme folder a page template view. Every theme folder holds the page templates, and folders like css and js because every theme can use their own seperated set of css and js files. It's a lot like the wp-content/themes folder which can hold several themes with their own css and js folders.
I tried the following:
PHP Code:
function ext_view($folder, $view, $vars = array(), $return = FALSE) {
$this->_ci_view_paths = array_merge($this->_ci_view_paths, array(FCPATH . $folder . '/' => TRUE));
return $this->_ci_load(array(
'_ci_view' => $view,
'_ci_vars' => $this->_ci_object_to_array($vars),
'_ci_return' => $return
));
}
I called ext_view like below and followed all data and it seems fine.
PHP Code:
$this->load->ext_view('themes', 'standard/index');
I'm not getting any errors. Only when I make some deliberate typos in the folder or view name, I get the expected CI errors like "
Unable to load the requested file: standard/index.php". I's like the output buffer code is not working with my template. But when putting an echo "test" at the end of the _ci_load function, "test" is echoed to the screen.
Has anyone tried something similar or has any ideas how to load a view outside the normal view and module/view folders?
Thanks in advance,
-Roger