philsturgeon / codeigniter-template

Template library for CodeIgniter which supports modules, themes, partial views, etc.
411 stars 178 forks source link

problem with Modules HMVC ( mx library ) and the static method run() #34

Closed zaherg closed 12 years ago

zaherg commented 12 years ago

i have this testing code which am working with .. i have a module called ms and and another one called test the test controller code is :

<?php
class Test extends MX_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->template->title($this->config->item('site_name','app'));
    }

    public function index()
    {
        $this->template->build('index');
    }
}

and the code inside ms is :

<?php
//ms module
class Msrofi extends MX_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->template->title($this->config->item('site_name','app'));
    }

    public function index()
    {
        $t = Modules::run('test/test/index');
        var_dump($t);
        $this->template->build('index_message');
    }
}

the problem is that the build function inside test is trying to find the index view file inside the ms views folder not the test views folder .. i checked the $this->_module and it gave me the ms module name ..

zaherg commented 12 years ago

its look like i have to make the Test Class like this

<?php
class Test extends MX_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->template->title($this->config->item('site_name','app'));
    }

    public function index()
    {
        $this->template->build('test/index');
    }
}

but it shows nothing .. the result of the var_dump($t) is empty string ..