[eluser]wilso417[/eluser]
Hey guys, new to the boards. Long time developer, new to CI + ME HMVC user. Looked on these boards and google for hours and could not find a solution to my problem.
I am going to be creating a new CMS. I noticed in my previous CMS I was copying a lot of the same functionality in each module, so i thought using the HMVC would be best for me. I really like it so far but am having some trouble setting up a base module and having child modules inherit from it. Here is an example of what I want to do. I want a base module called Content which will contain my common code. I then want a module called News whose controller would inherit from the Content controller.
class Content extends Controller {
function __construct() {
parent::Controller();
}
function content_not_found() {
$this->load->view('notfound');
}
}
class News extends Content {
function __construct() {
parent::__construct();
}
function display_news() {
// pseudocode to find news items in db
if (!$found) {
$this->content_not_found();
}
}
}
The problem is of course, CI returns 'Unable to locate the file: notfound.php'. I know this is probably because CI is looking for that view file in my News module folder, not the Content module folder.
I know not having News inherit from Content and then having News just 'use' that module:
$this->content->content_not_found() would work, but this would create more redundant code.
Anyone try to use a similar approach?