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.

Nested MVC

January 31, 2008 9:08pm

Subscribe [14]
  • #31 / Feb 14, 2008 8:12am

    BizComputing

    60 posts

    Have a busy day today, but let me take a look at my Loader extension class.  It’s working fine but I need to see if there’s any proprietary stuff in there before I make it public.

  • #32 / Feb 14, 2008 8:44am

    Edemilson Lima

    241 posts

    I think a good Loader extension must be simple and generic, with no restrictive things like the need for a submit() method, for example. Better if it allow us to call any method we want. It must be simple, to fit in any application. Also it could always return any loaded module result as a string.

    I hope you can release your extension for us. Thank you in advance!

  • #33 / Feb 14, 2008 10:40am

    BizComputing

    60 posts

    Code is available for just the Loader extension.  It is under bizLoader on the wiki.  Hopefully the documentation embedded in the code should be sufficient.

    Yes, the Loader extension is simple and generic.  When I mentioned my submit() and index() methods, I was talking about my module base class.  The Loader module method only makes 4 changes over loading just a library.

    1. It expects your module to be in your <application>/modules folder.
    2. It auto loads (but not instantiate) <application>/libraries/module.php in expectation that modules all extend the common class defined in module.php.
    3. It does not look into CI’s system directories if not found in your application folders.
    4. It has the ability to load but not instantiate the supplied module.

    This extension was written to support my applications and as such may not be useful to anyone else.  If you find ways to improve the code, I’ld love to hear about it.

    This extension is licensed via MIT license.  Hopefully that provides the most flexibility in use of the code without my losing my copyright.

  • #34 / Feb 14, 2008 9:39pm

    Edemilson Lima

    241 posts

    It’s awesome! I am studying and implementing it into my code.
    When I go more deeper on it, I will post here my comments.
    At this moment, thank you very very very much! 😊

    PS: does your name have something related to Jimi Hendrix?

  • #35 / Feb 14, 2008 9:51pm

    BizComputing

    60 posts

    😊 on Jimi Hendrix, my parents were clueless about pop culture at the time I was born.  So, I have lived with Purple Haze.

    Don’t think the entertainment industry is ready for a rockin Jimi Hendrix playing a clarinet.

  • #36 / Feb 14, 2008 10:11pm

    Edemilson Lima

    241 posts

    Today the entertainment industry only have these “canned” singers, no more real and natural talented singers/composers/gurus/masters from the old days…

    Do you play clarinet? I would like to play anything, but playing an instrument is not my beach…

  • #37 / Feb 14, 2008 10:13pm

    BizComputing

    60 posts

    Actually, you may want to go back to the wiki.  I added my module superclass in the same wiki post below the loader.

    As you can see, it’s really just a documented set of methods for structuring my modules to operate in a consistent manner.  There’s nothing stopping you from implementing a totally different module superclass, this is just what is currently working for me.  I can actually see a future where I may have a handful of different module superclasses, and at that point I would expand on my loader class to provide the name of the superclass as an argument.

    The real key thing on my module class is the structuring and the constructor which ensures every module has a reference to the hosting controller.

  • #38 / Feb 14, 2008 10:17pm

    BizComputing

    60 posts

    I played Clarinet for 9 years, the last 3 in a full orchestra.  I haven’t touched my Clarinet now in 20+ years.  I own a really nice Charles Walters piano since my daughter plays, but, sadly I can only plunk out little cheezy ditties cause I don’t have the time to properly learn how to play.

    That will be my retirement goal, to become a concert skilled pianist, at least it’s something to dream about.

  • #39 / Feb 14, 2008 10:26pm

    codex

    332 posts

    Hi Jim,

    thanks for the lib. I’m running into a bit of trouble though. I suppose you should autoload this lib simply by adding ‘biz_loader’ to the array, right?

    I’m getting ‘Unable to load the requested class: biz_loader’. I guess I’m doing something wrong, but what?

  • #40 / Feb 14, 2008 10:44pm

    BizComputing

    60 posts

    Nope, you just need to make sure your config’d prefix is biz instead of my, either that, rename the class to my_loader.

    Loader is automatically a part of the standard controller.

    One caveat, I have not attempted to use my loader in a PHP 4 environment.

  • #41 / Feb 14, 2008 11:02pm

    codex

    332 posts

    Nope, you just need to make sure your config’d prefix is biz instead of my, either that, rename the class to my_loader.

    Loader is automatically a part of the standard controller.

    One caveat, I have not attempted to use my loader in a PHP 4 environment.

    Ah, I’m on PHP4. I tried renaming to MY_loader, didn’t work. So I guess I can’t try it out.  😖

  • #42 / Feb 14, 2008 11:07pm

    BizComputing

    60 posts

    I think the problem is in how PHP 4 utilizes the Loader class.  In PHP 5, the Loader class is loaded like any other class and it’s services are then bound to the controller.  In PHP 4, Loader is the ancestor class which means that there is no ability to override without having to change the CI Core so that the PHP 4 controller inherits from your extension rather than from the CI Core Loader.

    With how extensible CI is, I’m actually suprised to see this inability to extend easily in PHP 4.

  • #43 / Feb 14, 2008 11:42pm

    wiredesignz

    2882 posts

    Zach has dealt with this PHP4 issue in Matchbox.

    I can’t really see the point of this biz_loader, everything in it can be achieved with libraries or plugins.

  • #44 / Feb 15, 2008 5:29am

    Edemilson Lima

    241 posts

    Actually, you may want to go back to the wiki.  I added my module superclass in the same wiki post below the loader.

    http://codeigniter.com/wiki/bizLoader

    I will take a look!

    I played Clarinet for 9 years, the last 3 in a full orchestra. I haven’t touched my Clarinet now in 20+ years.

    I think this is like walking in a bike. If you learn someday, I will never forget. The first steps when you start over may be difficult, but in a few days your brain will redo the old sinapsis and you will wonder that you still have the gift.

    I own a really nice Charles Walters piano since my daughter plays

    Wow! Really cool. My girlfriend plays piano too and love it, but she don’t have one to play. I want to give her at least an Yamaha sinthetizer.

    That will be my retirement goal, to become a concert skilled pianist, at least it’s something to dream about.

    To our lives have a special meaning we always must have dreams ahead to make real. Never give up of your dreams. They are the main fuel to your heart and brain. I am sure you will get this goal, because you already have knowledge of music and enough passion for it. My retirement goal is undefined yet, but I think I will never leave the computers. They are my passion. 😊

    But if someday I win a lot of money, I will “work hard” as a Millionaire Playboy! hahahaha! (Just kidding!) 😊

  • #45 / Feb 15, 2008 5:35am

    Edemilson Lima

    241 posts

    Ah, I’m on PHP4. I tried renaming to MY_loader, didn’t work. So I guess I can’t try it out.

    Did you also changed the function name from “biz_” to “MY_” inside the class?

    If we use a name like “MY_xxxxx” is also necessary to specify it in the autoload? Won’t it loads anyway?

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

ExpressionEngine News!

#eecms, #events, #releases