Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - HMVC version 5.3

Apart from getting errors due to not following CI library naming conventions, you will have two options:

Assign $this->form_validation->CI variable with an instance of the class containing the callback methods, be it either a controller or a model.

class Finance extends MX_Controller
    public $autoload = array(
        'language'   => array('finance'),
        'config'     => array('validation'),
        'libraries'  => array('form_validation'),
    function __construct() {

        /* set for validation callbacks */
        $this->form_validation->CI =& $this;
        $rules  = $this->config->item('rules');
        $labels = $this->config->item('labels');
        foreach ($rules as $field => $rule) {
            $this->form_validation->set_rules($field, $labels[$field], $rule);
    function index() {

or my preferred option:

You can place all of your callback methods into a MY_Form_validation extension and use them as native callbacks.

[eluser]Phil Sturgeon[/eluser]
I'm really excited to see this project being taken forward especially now that Modular Separation has been integrated into it.

I've found a few bugs so far such as the autoloader not working with non modular content and database config not working for groups other than default but im really struggling to get MY_Controller properties read throughout the system.

In your MX/Controller.php you have:

<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

require APPPATH."third_party/MX/Controller.php";

Other MY_ libraries in ME then create a MY_ and extend MX_ but controller does not do this. I have a MY_Controller so I am extending MX_Controller. I'd have thought MX_Controller would want to extend the main Controller but apparently it doesn't.

Anyhow, in MY_Controller I do lots of $this->foo = whatever then use $this->foo throughout my controllers, models, etc. Strangely all of these values work in MY_Controller when loaded and output, but when I load a model from MY_Controller and reference the global property it does not exist.

You "da man" on this one, I'm stumped! >.<

To use the HMVC features of my code all controllers must extend MX_Controller

class Any_Controller extends MX_Controller {}

If not then you have Modular Separation features only.

[eluser]Phil Sturgeon[/eluser]
Where does MY_Controller fit in, and other base classes such as Admin_Controller and Public_Controller that other controllers can extend?

[eluser]Ruben Müller[/eluser]
class Admin_Controller extends MX_Controller {}

class Hello_World extends Admin_Controller {}


[eluser]Phil Sturgeon[/eluser]
I'm happy to admit I dont have a full understanding on this one, as the code in ME is extremely bloody advanced. Basically I need to get my MY_Controller into the inheritance of everything, but if I make MY_Controller extend MX_Controller, then Admin_Controller extend MY_Controller then global properties are not available in code outside or MY_Controller.

Besides that I'm having a few errors without any of my modifications. Running a clean install (with nothing other than my extra MY_Controller class in the MY_Controller.php) I am getting this error http://drp.ly/1GCq1E

If you can hop on IRC then I'd like to go through these. Either I'm doing something wrong (more than likely!) or I have actually spotted a bug. It could go either way.

MY_Controller is never actually required as a class by CI, if the MY_Controller.php file is found it will be loaded automatically but it can contain any class declaration(s) you like.

The language issue might be solved if you create MY_Lang.php which requires MX/Lang.php and add the MY_Lang extends MX_Lang class declaration.

[eluser]Phil Sturgeon[/eluser]
As per our interesting conversation yesterday, you need to add the MY_Lang.php to the codebase to enable autoloading of languages. That will solve the error and that is not just something happening for me.

Thanks wiredesignz & Phil Sturgeon Smile

It's been quite awhile since I've played with CodeIgniter.

CI 2.0 with HMVC has me excited,

The two of you made it easy to get started.

I feel like a newbie again

Hi Phil and Wire:

I've installed the HMVC 5.3, removed MY_Controller from /application/libraries, and all works OK.
I need to access from one model to another, and from one controller to another model other than same name model, I don't know if would be better with or without MY_Controller ?

My web structure:

controllers (must to have access some product model functions)
views (here I put only contents, ussing 1/2/3colums as main templates)

controllers (must to have access some category model functions)
views (here I put only contents, ussing 1/2/3colums as main templates)

Thanks for your hard work, I think it's a great experience to work with it.


Theme © iAndrew 2016 - Forum software by © MyBB