10-28-2020, 09:23 AM
I am working on a CMS with [b]CodeIgniter 3.1.8[/b] and Bootstrap 4. I have decided to add themes to it.
The [i]themes[/i] directory is outside [i]application[/i] as can be see in the image below:
[color=var(--blue-700)]![[Image: syL0A.jpg]](https://i.stack.imgur.com/syL0A.jpg)
Inside [i]themes[/i] I have the theme directory (of course) which contains the "master view", layout.php:
[/color][color=var(--blue-700)]![[Image: gOGzZ.jpg]](https://i.stack.imgur.com/gOGzZ.jpg)
In application/core [/color]I have added a Loader.php file with the following contents:
In my Posts controller's index() method, I load the view passing it the data:
I get this error message:
[b]NOTE:[/b] the application is [b]not HMVC[/b], only MVC.
What am I doing wrong?
The [i]themes[/i] directory is outside [i]application[/i] as can be see in the image below:
[color=var(--blue-700)]
![[Image: syL0A.jpg]](https://i.stack.imgur.com/syL0A.jpg)
Inside [i]themes[/i] I have the theme directory (of course) which contains the "master view", layout.php:
[/color][color=var(--blue-700)]
![[Image: gOGzZ.jpg]](https://i.stack.imgur.com/gOGzZ.jpg)
In application/core [/color]I have added a Loader.php file with the following contents:
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH."../system/core/Loader.php";
class MY_Loader extends CI_Loader {
function ext_view($folder, $view, $vars = array(), $return = FALSE) {
$this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH . $folder . '/' => TRUE));
return $this->_ci_load(array(
'_ci_view' => $view,
'_ci_vars' => $this->_ci_prepare_view_vars($vars),
'_ci_return' => $return
));
}
}?>
In my Posts controller's index() method, I load the view passing it the data:
Code:
public function index() {
//more code here
$this->load->ext_view('third_party', 'themes/caminar/layout', $data);
}
I get this error message:
Code:
Call to undefined method CI_Loader::ext_view()
[b]NOTE:[/b] the application is [b]not HMVC[/b], only MVC.
What am I doing wrong?