Welcome Guest, Not a member yet? Register   Sign In
Problem with HMVC views partials
#1

[eluser]Unknown[/eluser]
I am learning to use HMVC for the first time but quite familiar with CI the 'traditional' way. I followed the installation instruction and everything went well.
I have a file application/modules/welcome/controllers/welcome.php with the following code:
Code:
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Welcome extends CI_Controller {

    
    public function index() {

        $this->load->view('welcome_message');
    }

}
The corresponding view file was located at application/modules/welcome/views/welcome_message.php
I went to http://example.com/index.php/welcome and got the welcome message as expected.

From the HMVC documentation I understand I can use a module as view partial by calling:
Code:
Modules::run('module');//controller has same name as module and method is index()

So I decided to create a controller under application/controllers/test.php. This is the code in the controller
Code:
<?php

class Test extends MX_Controller{
    public function __construct() {
        parent::__construct();
    }
    function  index()
    {
        echo Modules::run('welcome');
    }
}

But when I tried to visit http://example.com/index.php/test I got the following errors:

Unable to locate the views/ file: welcome_message.php

What am I getting wrong? Any help will be appreciated. Again I'm a newbie. Thanks




Theme © iAndrew 2016 - Forum software by © MyBB