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

[eluser]wiredesignz[/eluser]
The Modular Extensions HMVC, Bitbucket repository has been updated.

The Modules::$locations array may now be set in the application/config.php file. ie:
Code:
/*
|--------------------------------------------------------------------------
| Modules locations
|--------------------------------------------------------------------------
*/
    $config['modules_locations'] = array(
        APPPATH.'modules/' => '../modules/',
    );
#12

[eluser]Twisted1919[/eluser]
[quote author="wiredesignz" date="1296451708"]With HMVC you need to pass into or set the controller instance for the library before using it.
Code:
$this->load->library('form_validation');
$this->form_validation->CI = $this;

/* or */

$this->load->library('form_validation', array('CI' => $this));
And then process the parameters inside the library constructor.[/quote]
Hmm, i never had to do that, it just works like normal CI does.
Any thoughts why it is working without doing your suggested trick ?
#13

[eluser]mannysoft[/eluser]
Hi wiredesignz!

First of all thanks to codeigniter and all of its friendly users.

Im a big fan of codeigniter and HMVC and I'd been using this for a couple of years.

I have issues regarding codeigniter 2.0 and HMVC 5.4.

I try to use the new feature of codeigniter 2.0 which is the so called package. Using CI 2.0 I autoload the foo_bar folder that contains class called Sample with method name called tae. here is my class located in APPPATH.'third_party/foo_bar/libraries':

Code:
<?php
class Sample
{
    function tae()
    {
        echo 'Sample output ===!';    
    }
}

my autoload.php looks like:

Code:
/*
| -------------------------------------------------------------------
|  Auto-load Packges
| -------------------------------------------------------------------
| Prototype:
|
|  $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/

$autoload['packages'] = array(APPPATH.'third_party/foo_bar');

when I try to load the 'Sample' class I get some error:

An Error Was Encountered
Unable to load the requested class: sample

Here is my controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MX_Controller {

    function __construct()
    {
        parent::__construct();
        
        $this->load->library('sample');// error occurs here
        
        $this->sample->tae();
    }

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

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

but when I try to use the add_package_path:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MX_Controller {

    function __construct()
    {
        parent::__construct();
        
        $this->load->add_package_path(APPPATH.'third_party/foo_bar');
        $this->load->library('sample');
        
        $this->sample->tae();
    }

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

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

No errors occured. So the problem is the autoloading of package doesnt working. Some help is appreciated. Im using the latest codeigniter reactor 2.0 and HMVC version 5.4

Thanks and more power! ^.^
#14

[eluser]wiredesignz[/eluser]
Yes, I haven't updated Modular Extensions yet for autoloading package paths. I will do this soon.

You could copy the CI_Loader::_ci_autoloader code for autoloading packages and add it to the MX_Loader class if you need this urgently.
#15

[eluser]mannysoft[/eluser]
@wiredesignz: Thank you so much for a rapid reply!

God Bless! ^.^
#16

[eluser]Hartimer[/eluser]
I have a question. I've read the documentation and the philosophy behind HMVC looks exactly what i'm looking for.
However I'm concerned about the performance impact that it might have on large scale applications...

Does HMVC required much additional memory?
Does it add significant processing time to codeigniter?
#17

[eluser]libeco[/eluser]
I already posted this question elsewhere (here), but I thought I'd repost it here in the topic about Modular Extensions - HMVC.

I am having a problem with routing when using Modular Extensions - HMVC (latest version from 2011-03-06) with CodeIgniter 2.0 (not Reactor).

When I use this in application/config/routes.php:
Code:
$route['nieuws'] = 'news/news/index';
It works as expected.

When I remove that line and place it in application/modules/news/config/routes.php, the browser just sends me to the default controller.

Can anybody assist in this problem? Thanks in advance!
#18

[eluser]wiredesignz[/eluser]
The "news" module does not require it's own name to be specified in modules/news/config/routes.php
Code:
$route['nieuws'] = 'news/index';
#19

[eluser]libeco[/eluser]
Unfortunately that does not make any difference. Could there be any other reason why the routing is not working properly for me?

Thanks in advance!
#20

[eluser]otherjohn[/eluser]
Hi,

This issue might be related to HMVC

I have an ajax form in a module controller

after realizing that form validation was not working I added $this->load->library('form_validation', array('CI' => $this)); to it
and when I submitted my ajax form I got this error
Code:
ErrorException [ Fatal Error ]: Cannot use object of type Admin as array
SYSDIR/var/www/vhosts/churchbackend.com/_sys/libraries/Form_validation.php [ 90 ]

my controller is
Code:
class Admin extends Admin_Controller {

public $data=array();

    public function __construct()
       {
            parent::__construct();
            // Your own constructor code
       }

       function roles($user_id=NULL)
    {
        
               $this->load->library('form_validation', array('CI' => $this));
                if ($this->form_validation->run() == FALSE)
        {
                       ....show form
                }else{
                    echo "submitted";
               }
  }

my Admin_controller is
Code:
class Admin_Controller extends MX_Controller {
function __construct()
       {
            parent::__construct();
            
            ... load stuff        
    
       }




Theme © iAndrew 2016 - Forum software by © MyBB