• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modular Extensions - (HMVC) - Version 3.1.9

#1
[eluser]wiredesignz[/eluser]
This is Version 3 of the Modular Extension system. (3rd re-write)

The Modular Extension directories can now be organised with proper structure: ie Config, Controllers Libraries, Models, Views, Helpers and Plugins.

The module class loader is now an extension of CI_Loader allowing developers to configure how their classes are loaded and instantiated. A module can also replace its own class loader if something more custom is needed.

Version 3.1.9 is available on the wiki. Modular Extensions - (HMVC)

file is available for download: http://codeigniter.com/wiki/File:modular...s_319.zip/

Any feedback would be appreciated.

#2
[eluser]xwero[/eluser]
Maybe you should split up the classes in files and suggest where to put the files. This makes it easier for people to try your library. I'm going to check it out as soon as i can.

#3
[eluser]wiredesignz[/eluser]
A simple system similar to Matchbox modules would be to route all calls to a default controller then using _remap() you can determine which module to load.
Code:
$route['(.*)'] = 'default_controller/$1';

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

class Default_controller extends Controller
{
    function Default_controller()
    {
        parent::Controller();
        $this->load->model('default_model', '', TRUE);
    }
    
    function _remap($page, $content = '')
    {
        $this->search =& modules::load('search');
        
        switch ($page)
        {
            case 'index':

            case 'home':
                $content = modules::run('home');
                break;

            case 'showroom':
                $this->search->run();
                $content = modules::run('showroom');
                break;

            default:
                show_404();
        }        

        $this->render($page, $content);
    }
    
    function render($page, $content = '')
    {        
        $data = array(
            'title'   => Auction & Tender Centre',
            'content' => $content,
            'page'    => $page,
        );
        
        $this->load->view('default_layout' , $data);
    }
}

#4
[eluser]wiredesignz[/eluser]
[quote author="xwero" date="1203954855"]Maybe you should split up the classes in files and suggest where to put the files. This makes it easier for people to try your library. I'm going to check it out as soon as i can.[/quote]

It's all one file xwero, just drop it into application helpers and autoload helper 'modules'

I wanted to avoid packaging and core hacks. It also uses your method of altering _ci_view_path. Wink

#5
[eluser]xwero[/eluser]
It seems odd to me a helper has classes, anyway the code stays clean even with all those changes, good job!

#6
[eluser]wiredesignz[/eluser]
[quote author="xwero" date="1203956546"]It seems odd to me a helper has classes, anyway the code stays clean even with all those changes, good job![/quote]

I suppose you're right there, but the class definitions have to be loaded somehow, and the helper would be very sad without them. :lol:

@xwero: I just fixed a couple typo's in the Loader, $this->module->_assign_libraries is missing in two places. Please fix your copy if you have one.

#7
[eluser]wiredesignz[/eluser]
After using the above method to rebuild a customer website in just a few hours, I believe this will eventually have similar functionality to Matchbox modules and with no core hacks.

One file... plug and play. Smile

#8
[eluser]badgeek[/eluser]
how to load library from a module? i tried

Code:
$this->library('calendar');

it give me:

Fatal error: Call to undefined method tagging::library() in W:\www\leakrv2\app\modules\tagging\controllers\tagging.php on line 8

thanks!

#9
[eluser]badgeek[/eluser]
my bad.. i should use $this->load->library
thanks for this amazing helper its really help me
Smile

#10
[eluser]Edemilson Lima[/eluser]
@Wiredesignz: OMG! You are really fast! Are you the son of The Flash? :lol:

For me is also odd this library be placed in a helper... I think the code could be placed in a single file called "Module" into the "application/libraries" directory. After all it have the same status level of controllers and models.

What about if I want to keep the views and models of my modules into their original directories?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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