Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Version 4.3

[eluser]wiredesignz[/eluser]
Version 4.1.16 of Modular Extensions is available on the wiki

Feature added: Autoload module controllers.

Feature added: Module controllers are able to use different database connections.

[eluser]wiredesignz[/eluser]
Version 4.1.17 of Modular Extensions is available on the wiki

Feature bugfix: controller::instance('object') now returns correct controller and object to views.

[eluser]Developer13[/eluser]
I gotta say - this is pretty nice stuff. I finally started integrating ME into InkType, so expect to see it in InkType's Saturn release!

[eluser]dfau[/eluser]
Hi wiredesignz,

Just noticed in my logs that files are getting loaded multiple times - don't know if it's just debug, would you please be able to have a quick look and clarify? The below is test code only, vanilla CI 1.6.2 with ME 4.1.17, change welcome controller to call to two methods in one module.

Welcome controller:
Code:
class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();
    }

    function _foo() {
        modules::run('foobar', NULL, 'two');
    }


    function index()
    {
        modules::run('foobar', NULL, 'one');

        $this->_foo();

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

The module:
Code:
class Foobar extends Controller {
    /*
     */
    function
    Foobar() {
        parent::Controller();
    }

    /*
     */
    function
    one() {
    }

    function
    two() {
    }

and the log file:
Code:
DEBUG - 2008-06-03 17:47:03 --> Config Class Initialized
DEBUG - 2008-06-03 17:47:03 --> Hooks Class Initialized
DEBUG - 2008-06-03 17:47:03 --> URI Class Initialized
DEBUG - 2008-06-03 17:47:03 --> No URI present. Default controller set.
DEBUG - 2008-06-03 17:47:03 --> Router Class Initialized
DEBUG - 2008-06-03 17:47:03 --> Output Class Initialized
ERROR - 2008-06-03 17:47:03 --&gt; Severity: Warning  --&gt; fopen(../system/cache/70efdf2ec9b086079795c442636b55fb) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied /home/dfogarty/dev/ci162_me41/system/codeigniter/Common.php 49
DEBUG - 2008-06-03 17:47:03 --&gt; Input Class Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2008-06-03 17:47:03 --&gt; Language Class Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; Loader Class Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; File loaded: ../application/config/autoload.php
DEBUG - 2008-06-03 17:47:03 --&gt; Helpers loaded: url_helper
DEBUG - 2008-06-03 17:47:03 --&gt; Helpers loaded: file_helper
DEBUG - 2008-06-03 17:47:03 --&gt; Database Driver Class Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; Welcome Controller Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; File loaded: ../application/modules/foobar/controllers/foobar.php
DEBUG - 2008-06-03 17:47:03 --&gt; File loaded: ../application/config/autoload.php
DEBUG - 2008-06-03 17:47:03 --&gt; Helpers loaded: url_helper
DEBUG - 2008-06-03 17:47:03 --&gt; Helpers loaded: file_helper
DEBUG - 2008-06-03 17:47:03 --&gt; Database Driver Class Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; Foobar Controller Initialized
DEBUG - 2008-06-03 17:47:03 --&gt; File loaded: ../application/views/welcome_message.php
DEBUG - 2008-06-03 17:47:03 --&gt; Final output sent to browser
DEBUG - 2008-06-03 17:47:03 --&gt; Total execution time: 0.0660

EDIT: It looks like files get re-loaded when a module is loaded...?
EDIT: also Database class says it's initialised again.
EDIT: and autoloading just database library, url helper and file helper

Thanks very much,
df

[eluser]wiredesignz[/eluser]
Thanks dfau Wink

Yes, I am aware of this, each module controller checks config/$autoload.php and incorrectly attempts to load items already loaded.

This will be resolved in 4.1.18

[eluser]dfau[/eluser]
No worries wiredesignz, noticed the change between 4.1.11 and 4.1.17 when doing some profiling. Thanks again for all your hard work, looking forward to seeing .18.

df

[eluser]wiredesignz[/eluser]
Fixed Wink
Code:
DEBUG - 2008-06-04 02:08:43 --&gt; Config Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Hooks Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; URI Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; No URI present. Default controller set.
DEBUG - 2008-06-04 02:08:43 --&gt; Router Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Output Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Input Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2008-06-04 02:08:43 --&gt; Language Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Loader Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Helpers loaded: debug, parser, url, form, html
DEBUG - 2008-06-04 02:08:43 --&gt; Database Driver Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Model Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Default Model initialised as
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/config/autoload.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/search/controllers/search.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/config/autoload.php
DEBUG - 2008-06-04 02:08:43 --&gt; Search Controller Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/models/vehicles_model.php
DEBUG - 2008-06-04 02:08:43 --&gt; Model Class Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; Default Model initialised as stock
DEBUG - 2008-06-04 02:08:43 --&gt; Default_controller Controller Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/home/controllers/home.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/config/autoload.php
DEBUG - 2008-06-04 02:08:43 --&gt; Home Controller Initialized
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/home/views/hot_pick.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/home/views/hot_pick.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/home/views/hot_pick.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/home/views/hot_pick.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/home/views/home_content.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/modules/search/views/box.php
DEBUG - 2008-06-04 02:08:43 --&gt; File loaded: application/views/default_layout.php
DEBUG - 2008-06-04 02:08:43 --&gt; Final output sent to browser
DEBUG - 2008-06-04 02:08:43 --&gt; Total execution time: 0.0359

[eluser]wiredesignz[/eluser]
Version 4.1.18 of Modular Extensions is available on the wiki

Feature bugfix: controller autoload problem fixed. Thanks dfau Wink

[eluser]freshface[/eluser]
Is it possible to show an example in how this extensions is usefull?

[eluser]sophistry[/eluser]
a quick answer is this (and this is by no means the whole picture):

if you make a nice self-contained model-controller-view set of files and then you want to include that MVC in another project by copying one folder - everything is in one place instead of spread around model, view and controller folders.

also, from another controller, you can get some of the nice output from the original, tidy MVC set without calling a controller via URI (i.e., another http call using file_get_contents() or curl). you can get controller output without having to go out through the http interface again.

hope that's clear - there are other advantages too. please share your thoughts.




Theme © iAndrew 2016 - Forum software by © MyBB