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.

Matchbox RC2

November 25, 2007 2:24pm

Subscribe [65]
  • #16 / Nov 27, 2007 9:32am

    nassdzr

    3 posts

    Zacharias, i know this one is a fabulous library you’re developing.

    if somehow from one module controller,  can i use other method from another module controller class? Do i will break MVC concept with this? Or your library means only to load another module’s model/view/library/config/etc.. except controller?

    thankyou 😊

  • #17 / Nov 27, 2007 9:36am

    zdknudsen's avatar

    zdknudsen

    305 posts

    Using controller methods from other controllers than the currently loaded one is a limitation of CodeIgniter itself and I belive it has been discussed before. Have a look at this thread:

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

  • #18 / Nov 27, 2007 11:57am

    zdknudsen's avatar

    zdknudsen

    305 posts

    Matchbox 0.9.1 has been released. It now includes a configuration file for configuring in which directories to look for modules. Documentation has been updated accordingly.

    Downloads and changelog both found on http://matchbox.googlecode.com/.

  • #19 / Nov 29, 2007 7:10am

    pestilence's avatar

    pestilence

    7 posts

    Hello there,
    I think I have a problem with matchbox, parameters are not parsed properly for my application.
    To be more specific I have the following directory structure on my test box:

    codeigniter\system\application\modules\newsletter\

    Which has the following folders (the newsletter directory):

    controllers
    libraries
    views

    Inside controllers I have 2 files

    form.php
    subscribe.php

    Everything works fine except parameters!
    For instance In my form.php I have the following class functions:

    class Form extends Controller {
        
        function index()
        {
            $this->load->view('form');
        }
        
        function lang($lang = null)
        {
            if( $lang !== null )
            {
                echo "Language: $lang\n";
            } else {
                echo "No Language!\n";
            }
        }
    }

    When calling in my browser:
    http://localhost/codeigniter/newsletter/form

    My form is properly displayed.
    If I call it:
    http://localhost/codeigniter/newsletter/form/lang I get:

    Language: lang

    This remains the same even if I:
    http://localhost/codeigniter/newsletter/form/lang/greek
    I get:

    Language: lang
  • #20 / Nov 29, 2007 8:11am

    pestilence's avatar

    pestilence

    7 posts

    Ok I think I found the problem:
    file: Router.php (CI core)

    function _reindex_segments()
        {
            // Is the routed segment array different then the main segment array?
            $diff = (count(array_diff($this->rsegments, $this->segments)) == 0) ? FALSE : TRUE;
        
            $i = 1;
            foreach ($this->segments as $val)
            {
                $this->segments[$i++] = $val;
            }
            
            unset($this->segments[0]);
            
            if ($diff == FALSE)
            {
                $this->rsegments = $this->segments;
            }
            else
            {
                $i = 1;
                foreach ($this->rsegments as $val)
                {
                    $this->rsegments[$i++] = $val;
                }
                unset($this->rsegments[0]);
            }
        }

    Commenting out the line where the rsegments array is assigned the segments array seems to resolve the issue:

    if ($diff == FALSE)
    {
      //$this->rsegments = $this->segments;
    }
  • #21 / Nov 29, 2007 8:22am

    pestilence's avatar

    pestilence

    7 posts

    Post #1 here:
    http://ellislab.com/forums/viewthread/64013/

    I would recommend overriding CI’s default _reindex_segments inside matchbox so this issue is fixed without needing to touch the core file.

    $diff = (count(array_diff($this->rsegments, $this->segments)) == 0) ? FALSE : TRUE;

    To:

    $diff = (count(array_diff($this->segments, $this->rsegments)) == 0) ? FALSE : TRUE;

    Previous fix posted not needed anymore (the on in this post works just fine.

  • #22 / Nov 29, 2007 5:28pm

    zdknudsen's avatar

    zdknudsen

    305 posts

    So this is a native CI bug?

    Will fix it anyway, but I’ll have a look at it myself first. 😊

  • #23 / Nov 30, 2007 3:22am

    Majd Taby's avatar

    Majd Taby

    637 posts

    Hey, I’m seriuosly considering changing JTaby from an app to a matchbox module. Just for reassurance purposes: I can provide a download, which people can grab and just drop in their CI installation?

  • #24 / Nov 30, 2007 4:31am

    pestilence's avatar

    pestilence

    7 posts

    So this is a native CI bug?

    Will fix it anyway, but I’ll have a look at it myself first. 😊

    Yes it is 😊 But for some wierd reason there has not been released an update version (wierd) thats why I recommend implementing it (for the moment at least) inside matchbox and overriding CI core function. 😊

  • #25 / Nov 30, 2007 6:36am

    zdknudsen's avatar

    zdknudsen

    305 posts

    Hey, I’m seriuosly considering changing JTaby from an app to a matchbox module. Just for reassurance purposes: I can provide a download, which people can grab and just drop in their CI installation?

    Yes, that’s the idea behind Matchbox 😊 I’ve made a great effort to make the transition from app to module as easy as possible. In most cases it would be as easy as to move the files from your resource folders into the module folder. Please contact me if you have any questions or encounter problems.

  • #26 / Nov 30, 2007 5:40pm

    idxman

    6 posts

    Great stuff Zacharias!  As I’m looking to find a new framework the ‘modules’ concept is one of the ‘must have’ items on my list.  😊  One step closer to CI.

  • #27 / Dec 01, 2007 10:33am

    gerben

    75 posts

    gerben: Guess what? I got it working smile I’ve made a config file containing an array of directories relative to your application folder in which codeigniter should look for modules. It’ll be included in the next release (it’ll require some more tweaking and testing).

    Wow, this is just marvelous! Wonderful, I’ll update my app, and check it out! Thanx so much, this will make it even more flexible!

    I have still have a question, though: I use the view library (http://ellislab.com/forums/viewthread/49910/) for calling views, and when Matchbox was called Modular Separation, the two went together very well. I could just call the views like:

    $this->view->load('my_view');

    And Matchbox would find it in the module-folder.


    But since I updated from “modular separation” to Matchbox, Matchbox can’t find my views anymore. I solved it by going:

    $this->view->load('../modules/my_module/views/my_view');

    But this is not a really beautiful approach. Is there a way to keep using the two together?

    Anyway, you’re doing something really exciting here, keep up the good work!

  • #28 / Dec 01, 2007 10:36am

    zdknudsen's avatar

    zdknudsen

    305 posts

    Hm… Odd. Does it work when not using the view library?

  • #29 / Dec 01, 2007 10:52am

    gerben

    75 posts

    You mean when I change

    $this->view->load('settings');

    to:

    $this->load->view('settings');

    ?

    Then it works fine of course 😉 But this way I won’t be able to load view parts into the main view, like:

    $this->view->part('my_sidebar');

    And I’ll have to change the way variables are passed to the view in my modules. The strange thing is that they both went together well before.

  • #30 / Dec 01, 2007 11:09am

    zdknudsen's avatar

    zdknudsen

    305 posts

    That’s wierd.. :S $this->view->load(’‘) is basicly an alias for $this->load->view(), just with some added functionality before the call. So I don’t understand why one of them works while the other doesn’t. Did this happen in 0.9 also or only in 0.9.1?

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

ExpressionEngine News!

#eecms, #events, #releases