ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Modular Extensions - HMVC version 5.4

January 29, 2011 1:58am

Subscribe [99]
  • #271 / Jul 26, 2012 7:38am

    wiredesignz

    2882 posts

    ... is this version compatible with the latest version of CodeIgniter? And what are the known bugs in using this? ...

    Yes it is totally compatible. The only bugs that are evident are due to some developers lack of understanding of PHP and CodeIgniter.

  • #272 / Jul 26, 2012 7:45am

    rei

    67 posts

    thanks for your reply sir 😊 I’m using it right now and i really liked it! So this extension is really stable. Thanks again for your reply sir 😊 one more question.. If a new version of CI comes out can I safely upgrade my site built w/ codeigniter and this modular extension?

  • #273 / Jul 26, 2012 8:00am

    wiredesignz

    2882 posts

    Yes of course. Modular Extensions - HMVC will continue to match CodeIgniter development for as long as possible.

  • #274 / Jul 26, 2012 8:21am

    rei

    67 posts

    okay sir thanks for the info and for your hard work. I’m using this extension now and in fact I’m now rewritting my code from MVC to HMVC because it will be a large compilation of codes after months of development and by using this extension the codes will be more easy to maintain and modify because it will be more organized. Thanks again 😊

  • #275 / Jul 26, 2012 10:35am

    rei

    67 posts

    Hi, can someone please give me a link in how would I integrate Ion Auth library in a CodeIgnier w/ modular extensions HMVC setup? Or can someone give me ideas how to integrate it?

    EDIT:

    Problem solved.
    http://ellislab.com/forums/viewthread/221689/

  • #276 / Aug 14, 2012 6:20pm

    ezmeeting

    1 posts

    There appears to be a bug in the HMVC loader class when loading a library using an alias.  I need two different instances of a library on the same page. 

    For instance,

      $this->load->library(‘template’, NULL, ‘instance_1’);

      $this->load->library(‘template’, NULL, ‘instance_2’);

    But I always get back instance_1.

    The problem appears to be in the MX/Loader method library().  Once the first load of the library class get cached, it always returns and doesn’t allow the alias logic for the second call to execute

    public function library($library = ‘’, $params = NULL, $object_name = NULL) {

    if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class])
    return CI::$APP->$_alias;

    }

    Am I missing something?

    thx

     

  • #277 / Sep 10, 2012 4:26am

    Keat Liang

    29 posts

  • #278 / Sep 17, 2012 4:22am

    ZaLiTHkA

    29 posts

    I’ve been playing around with HMVC for a little while now, but I’m trying to do something now that’s pushing rather hard on the boundaries of my PHP knowledge.. So, here’s me hoping someone here could help point me in the right direction or give me a few tips. 😊

    For the moment all I’m looking at is the loading of views. Currently, this HMVC extension checks for the requested view in the ‘application/[current_module]/views’ first, then the default ‘application/views’ folder if the first is false. In my little pet project, I would like to insert my own ‘view’ folder location check just before the HMVC one.

    Working with the following folder structure:

    /* -------------------------------------
    - application
      - modules
        - module_a
          - controllers
            - module_a.php
        - module_b
          - controllers
            - module_b.php
          - views
            - module_b.php
        - module_c
          - views
            - module_a.php
            - module_c.php
    ------------------------------------- */

    If I do something like this:

    class Module_a extends MX_Controller {
        public function index() {
            $this->load->view('module_a');
        }
    }

    I would like to check the ‘module_c’ views folder first for a match, then the current module (module_a) if the first check is false. Just to add another interesting twist, I’ve already completely removed the default ‘application/views’ folder, since it’s not going to be used for this project. 😊

    Would I need to edit the ‘public function view()’ function in ‘third_party/MX/Loader.php’, or could I perhaps do this outside of that file?

  • #279 / Sep 17, 2012 6:32am

    XMadMax

    66 posts

    Thanks wiredesignz, HMVC absolutely essential for my developments.

    I have made a mix between CI 2.1.2, HMVC 5.4 and a common application folder.

    Inside the common application folder are the HMVC, leaving the normal application folder untouched.

    Also, with common folder, you can have modules, libraries, helpers, third_party, shared between many application folders.

    This is a basic approach to those who need a general application (modules, controllers, views, libraries, helpers, language, etc, but only a small customization is needed for different purposes.

    Then, you have a ‘common’ folder, also a ‘application1’ folder, ‘application2’ folder and so on…

    Take a look at: https://bitbucket.org/xperez/codeigniter-cross-modular-extensions-xhmvc

  • #280 / Sep 25, 2012 9:08pm

    goFrendiAsgard

    125 posts

    Hi everyone, I have a problem related to using get_instance after extend my controller from MX_Controller.
    I write everything here: http://ellislab.com/forums/viewthread/224908/

    Hopefully someone can help me.
    Thanks

  • #281 / Sep 26, 2012 1:27am

    ilumos

    3 posts

    Hello all,

    I’m having trouble getting my head around how to do view partials right, without repeating lots of code.

    http://ellislab.com/forums/viewthread/224791/

    In hindsight, I should’ve posted my problem in here, rather than the code forum.

    Any help appreciated.

    Thanks!

  • #282 / Oct 04, 2012 12:48am

    nsyed

    3 posts

    Found a bug in HMVC’s Loader that leads to a “Fatal error: Maximum function nesting level of ‘100’ reached, aborting!”

    The error can be reproduced by creating an autoload config file within a module and adding a library to load. Ex:

    modules/
    ..admin/
    ....config/
    ......autoload.php
    ....libraries/
    ......admin_controller.php

    The problem was that the ‘_autoloader’ function kept recursively trying to “autoload” the library regardless of whether or not it’s already loaded. This lead to an endless loop where the loaded file (which extends the MX_Controller) called it’s parent controller which in turn tried to ‘initialize’ on every call in which ‘_autoloader’ was called again and again (a recursive result of the infamous ‘goto’).

    I solved this by adding a line in the Loader to check if the class was already loaded so it doesn’t recurse itself…

    // MX/Loader.php
    // line (396-398)?:
    // -> replace:
    // foreach ($autoload['libraries'] as $library) {
    //     $this->library($library);
    // }
    // -> to:
    foreach ($autoload['libraries'] as $library) {
        if (class_exists($library, FALSE)) continue;
        $this->library($library);
    }


    ~NS

  • #283 / Oct 04, 2012 2:38am

    wiredesignz

    2882 posts

    The problem occurs because you have incorrectly put a controller into the libraries directory.
    I don’t agree that altering any code is required because the library loader already checks for the class so you’re just duplicating code to fix your mistake.

  • #284 / Oct 04, 2012 3:40am

    nsyed

    3 posts

    The problem occurs because you have incorrectly put a controller into the libraries directory.
    I don’t agree that altering any code is required because the library loader already checks for the class so you’re just duplicating code to fix your mistake.

    Do the modules support extending the core class? or look for the extensions in a special folder where I can place my custom classes to extend the core through a module? Duplicating code to fix my mistake..? I’m sorry, didn’t know you would be offended by a simple solution that makes it easier to extend core..

    I know you can add a separate function in HMVC to look into a “core” folder within the module and extend core classes from thereon but I’m a bit lazy so that was sufficient lol.

  • #285 / Oct 04, 2012 3:55am

    wiredesignz

    2882 posts

    I’m not offended at all. Just stating a fact.

    CI conventions indicate that controllers and their ancestors provide core functionality they are not defined as libraries.

    If you need a base controller you can create a core directory in your module and include the parent class as per your normal PHP directives or place them into the application/core directory to be autoloaded.

    Also if you load a base controller as a library then you are instantiating a redundant controller instance which seems pointless.

    In future it might be worth looking at the Modules::autoload() method to accommodate loading core files from modules too.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases