Having troubles with Loader class and HMVC

Hi all,
My problem is that i want to rename the views folder name into templates(makes more sense for my new project) without hacking into core files.

Based on that, i thought that extending the CI_Loader class would do the trick .
So i have my MY_Loader.php:
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

class MY_Loader extends CI_Loader{

public function __construct()
        parent::CI_Loader ;
        $this->_ci_view_path = APPPATH.'templates/';

But it just jumps over it, it doesn't load it at all.
Might this be an issue because of the HMVC library ?
Any suggestions ?

Oups, my bad , seems like i should create MX_Loader.php instead of MY_Loader.php . Now it works .
Another question that i have .
Now it loads the template files from /templates instead of /views .
But if i create a templates folder in my module, the files will not be loaded, any way to fix this ?

Me again Big Grin
My first approach was kinda wrong i think .
All i had to do :
1. On HMVC's Controller class after line 85 (the foreach loop) i added :
$this->_ci_view_path = APPPATH.'templates/';
//So it becomes
/* ci loader references */
        foreach (get_class_vars('CI_Loader') as $var => $val) {
            $this->$var =& CI::$APP->load->$var;
        $this->_ci_view_path = APPPATH.'templates/';
On line 239 , in the load function i've changed to :
list($path, $view) = Modules::find($view, $this->_module, 'templates/');
//instead of
list($path, $view) = Modules::find($view, $this->_module, 'views/');

And on Modules.php on line 168 i changed to
if ($base == 'models/' OR $base == 'forms/' OR $base == 'templates/')
//instead of
if ($base == 'views/' OR $base == 'models/' OR $base == 'forms/')

Now it works perfect , maybe this will help somebody else without HMVC experience as i am Smile

All you really need is to leave views and add an offset for load->view() to use the templates directory, something like:
$config['templates'] = '../templates/';
$templates = config_item('templates');
$this->load->view($templates.'someTemplate', $data);

Yes , this makes sense , didn't try it yet but i am sure it will work Smile
Thanks .

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.