How can we setup multiple themes in codeigniter as in Magento?
I want to do this in HMVC CI. I want to add theming feature with my development. I am using HMVC setup from Codeigniter HMVC
This is properly set and works fine. This is a great development approach. Here I am trying to add theme feature with this code, that could be controlled from admin panel.
/themes/themeName/templates/
/themes/themeName/modulesName/View
Approach is if view file not found in themes folder, it should come from
application/modules/moduleName.
What changes I have to do with this script ?
Can anyone suggest me what modification nee to do with this code?
Perhaps I misunderstood but why not extend CI's Loader class and add a theme function? I did this recently and it works great.
public function theme($view, $theme, $vars = array(), $return = FALSE) {
// Check if extension was specified. If not, add .php
$ext = pathinfo(APPPATH . $theme, PATHINFO_EXTENSION);
$view_file = ($ext == '') ? $view.'.php' : $view;
// Verify whether or not the requested theme file exists and set the template directory path prefix accordingly
if(file_exists(APPPATH . "views/store/theme/$theme/$view_file")) {
$this->_ci_view_paths = array(APPPATH . "views/store/theme/$theme/" => true);
}
else {
$this->_ci_view_paths = array(APPPATH . "views/store/theme/default/" => true);
}
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}