Welcome Guest, Not a member yet? Register   Sign In
Matchbox RC2

[eluser]Michael;[/eluser]
Ah... I see. I was thinking more along the lines of each separate application as a separate module. thus making the need for something like Matchbox nonexistent.

Though, modularity in a rather large application would be nice at times.

Thank you for the clarification.

[eluser]Gerard N[/eluser]
Zach, or anyone in the community,

First of all, Zach I am gob smacked to see the amount of work that has been put in by you and the community to this modular support for CI. Truely awesome stuff. I have been out of the CI head space for a little over a year, and the community has really exploded with great add ons to an already fantastic framework.

Sorry if these two questions have already been asked. I did a search of the forum, but I am really exhausted and could have missed it.

Question 1:
Using the $config['directories'] array is it possible to specify directories that are above the application directory?
Code:
$config['directories'] = array('modules');
// eg
$config['directories'] = array('../system/modules');

Question 2:
What I am trying to achieve is the following arrangement of modules. The idea being that if module_b exists in both the application/modules and the system/modules folder that the application version will be used over the system version.

How is modules with the same name in different 'modules' directories currently handled?
Code:
- application
-- modules
--- module_a
--- module_b
- system
-- modules
--- module_b

Thank you to anyone who can help.
- Gerard

[eluser]zdknudsen[/eluser]
So, I'm finally back Smile

Okay I see that a lot of you have some great suggestions and ideas, however in order to avoid this thread becoming too messy, I encourage you all to post whatever suggestions you might have on the Matchbox Development google group (http://groups.google.com/group/matchbox-development), it'll be much easier for me to have a look at each request seperately.

Now, all the other questions...

-----

Starbbs: No you do not have to add the mentioned libraries to the 'callers' array. Are this causing you any problems or were you simply wondering why that is the case?

I am aware that resource location does not replace said slashes. Actually, that is because CodeIgniter itself is not always doing so itself, and so when I use BASEPATH / APPPATH the slashes might be wrong. Is this causing you any trobule?

-----

dreamynsx: Actually, Matchbox check if the url is a module as the first thing. So that means one would have to use a "standard controller"-prefix. Is this something people would like to see implemented?

-----

Gerard N:
1. question: Yes, you most certainly can. As a matter of fact, the feature was implemented for a guy who wished to have a module folder just outside his application folder Smile

2. question: The same module names in different module directories will be handled in the order of the directories array. That means that if you have the same module in two places, the directory that is first in the directories array will be the one that is loaded from (however the requested resource is not present in the first one, it will be looked for in the next one).

-----

I hope that's all of them, just let me know if I missed your question. (and remember to post suggestions and the like on the google group).

[eluser]phpwebdev[/eluser]
Hi Im new with "Matchbox" ,

Can someone send me link to download work example like this
http://www.haughin.com/screencasts/ - if screencasts exist ?

Regards
phpwebdev

[eluser]gon[/eluser]
[SOLVED, see next post]

Hi,

I am having a problem storing controllers in module subfolders.
The module is admin.
Inside the controllers folder, I have a subfolder named users.
Inside users folder, a controller named edit.

http://localhost/admin/users/edit

shows a 404,

controllers inside the module (not in subfolders) work correctly.

Any ideas?

Regards,

[eluser]gon[/eluser]
Hi everyone,

On the last post I had a problem with controllers into subfolders.
In the docs it is explained that the controller folder should be BEFORE the module name on the URL.
This way it works correctly.

But I'd prefer having the URL segments in the "right" order, something like this:

/modulename/controllersfolder/controller/method]

So I made a change on MY_Router.php file of Matchbox.
Changed function _validate_request to this:

Code:
/**
     * Validates the supplied segments
     *
     * @param  array
     * @return array
     * @access private
     */
    function _validate_request($segments)
    {
        // {{{ Matchbox
        
        foreach($this->_matchbox->directory_array() as $directory) {
            if (count($segments) > 1 && $segments[0] !== $segments[1] && file_exists(APPPATH . $directory . '/' . $segments[0] . '/controllers/' . $segments[1] . EXT)) {
                $this->_matchbox->set_directory($directory);
                $this->_matchbox->set_module($segments[0]);

                $segments = array_slice($segments, 1);

                return $segments;
            }

            if (count($segments)==1 && file_exists(APPPATH . $directory . '/' . $segments[0] . '/controllers/' . $segments[0] . EXT)) {
                $this->_matchbox->set_directory($directory);
                $this->_matchbox->set_module($segments[0]);
                
                return $segments;
            }
            
            if (count($segments) > 2 && file_exists(APPPATH . $directory . '/' . $segments[0] . '/controllers/' . $segments[1] . '/' . $segments[2] . EXT)) {
                $this->_matchbox->set_directory($directory);
                $this->_matchbox->set_module($segments[0]);
                $this->set_directory($segments[1]);

                $segments = array_slice($segments, 2);        

                return $segments;
            }
            
            if (count($segments) > 1 && file_exists(APPPATH . $directory . '/' . $segments[0] . '/controllers/' . $segments[1] . '/' . $segments[1] . EXT)) {
                $this->_matchbox->set_directory($directory);
                $this->_matchbox->set_module($segments[0]);
                $this->set_directory($segments[1]);

                $segments = array_slice($segments, 1);

                return $segments;
            }
            
        }

        // }}}

        if (file_exists(APPPATH . 'controllers/' . $segments[0] . EXT)) {
            return $segments;
        }

        if (is_dir(APPPATH . 'controllers/' . $segments[0])) {
            $this->set_directory($segments[0]);
            $segments = array_slice($segments, 1);

            if (count($segments) > 0) {
                if (!file_exists(APPPATH . 'controllers/' . $this->fetch_directory() . $segments[0] . EXT)) {
                    if ($this->_fail_gracefully) {
                        return array();
                    }

                    show_404();
                }
            } else {
                $this->set_class($this->default_controller);
                $this->set_method('index');

                if (!file_exists(APPPATH . 'controllers/' . $this->fetch_directory() . $this->default_controller . EXT)) {
                    $this->directory = '';
                    return array();
                }
            }

            return $segments;
        }

        // {{{ Matchbox

        if ($this->_fail_gracefully) {
            return array();
        }

        // }}}

        show_404();
    }

For me it's working correctly, but I'll post any issues if I find any.

[eluser]zdknudsen[/eluser]
That functionality is intended actually Smile But if you wish I can make it a configurable option in the next release.

[eluser]gon[/eluser]
Definitely that would be nice.

Why do you prefer the folder to appear before module in the URL?

Regards.

[eluser]zdknudsen[/eluser]
Well, you already have the module as a prefix, so I though also being able to use subfolders was unnessesary (but apparantly I was wrong).

The most obvious use is for this the administration part of a module. Say you had a blog module. It'd be accessed through www.example.com/blog/controller. Now if you wanted to administrate said blog through the url www.example.com/admin/blog/controller you'd have to make another module with the administration functionality. However, the way Matchbox is currently build you can have the administration within the same module, just in another subfolder.

[eluser]gon[/eluser]
Thanks for the example.

Anyway, IMHO the idea of having the admin section under
http://www.example.com/blog/admin/controller
is quite intuitive.
Perhaps having the option of choosing the way of routing for each module could be handy.

Cheers.




Theme © iAndrew 2016 - Forum software by © MyBB