CodeIgniter implements the method of changing the path of view folder

  • 2021-07-06 10:34:55
  • OfStack

Code for controlling view folder path: system/core/loader. php


public function add_package_path($path, $view_cascade=TRUE)
{
$path = rtrim($path, '/').'/';
array_unshift($this->_ci_library_paths, $path);
array_unshift($this->_ci_model_paths, $path);
array_unshift($this->_ci_helper_paths, $path);
$this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; //  Add Configuration File 
$config =& $this->_ci_get_component('config');
array_unshift($config->_config_paths, $path);
}

Change the view folder statement to:


$this->load->add_package_path ( FCPATH . 'skins/' . base_skins . '/' );

Pay special attention to:

You need to create another views folder under the newly created skins folder, and all view files are stored under the skins/views folder


Related articles: