Default settings is one module directory, which means (max) two more checks per resource.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
November 25, 2007 2:24pm
Subscribe [65]#286 / Mar 16, 2008 5:02pm
Default settings is one module directory, which means (max) two more checks per resource.
#287 / Mar 16, 2008 5:12pm
Yeah, I was only using the modules directory, but I think it was the custom routing/load library that causes the performance overhead.
#288 / Mar 16, 2008 5:22pm
Indeed it is. Let me give you an example:
One of your users request the page example.com/forums/viewthread/65749
Matchbox will look for the following files (in this specific order):
modules/forums/controllers/viewthread.php
modules/forums/controllers/viewthread/65749.php
modules/forums/controllers/viewthread/viewthread.php
modules/forums/controllers/forums.php
... followed by the standard codeigniter routes
controllers/forums.php
controllers/forums/viewthread.php
That means that your module controllers will have less file_exist() calls, than a standard controller.
#289 / Mar 18, 2008 8:24pm
Hi Zach and crew,
I haven’t been around since I downloaded and installed Matchbox 0.9.2 back in Feb. It was wonderful how well it just dropped in to my system (upgrading from Modular Separation).
I was wondering if there was a version history somewhere so I can see what the difference is between 0.9.2 and 0.9.4. I had a look on the google code site and didn’t see anything, and had a bit of a scan through the forum, but may have missed it.
Cheers,
Gerard
#290 / Mar 18, 2008 10:07pm
http://code.google.com/p/matchbox/wiki/Changes
You can find a very sparse changelog here, however, most of the changes I’ve made haven’t been noted 😛 I’m too lazy. Anyway, as with upgrading from Modular Separation, you shouldn’t have any trouble upgrading Matchbox.
One thing you should note is that the filenames have changed, so you need to delete the old files before adding the new, otherwise you have will get trouble (like many others). The reason behind this is that it fixes the PHP4 problem, so no need for a fix.
#291 / Mar 23, 2008 7:46am
Hey Zach and community,
To Zach: Regarding the change log… The one you directed me to has all the logs up to the version I have 😊 (0.9.2)
Can you recall some of the bigger new things/fixes (other than the license change) in the latest two versions of matchbox?
What is the “the PHP4 problem” you mentioned? I tried to scan through the thread but nothing caught my eye. I am a bit weary though (too many hours coding).
To Everyone:
Can you guys help me out? Not sure if this is the right place for this question.
I’m not sure if I just don’t get the custom routing of CI or if Matchbox is affecting custom routes.
I am trying to do this custom route:
$route['issue/(\d+)/page/(\d+)'] = 'my_module/my_controller/view_issue/$0/$1';The routing to the controller works great, it just isn’t getting the parameters correct. view_issue keeps thinking ‘page’ is the second parameter.
I found that the following works…
$route['issue/(\d+)/(\d+)'] = 'my_module/my_controller/view_issue/$0/$1';...but was really hoping to get the first version working.
Any help on this would be appreciated.
Cheers,
Gerard
#292 / Mar 23, 2008 8:19am
The PHP4 problem, is that you can’t extend the Loader class in PHP4 (and the crew refuses to fix this 😛 , see bug report). So in the later versions I overwrote it instead, thus leaving no need for a PHP4 fix file.
Most of the chances after 0.9.2 has been bugfixes as far as i recall. However, I know I added some (debug) logging and the possibility of changing the default view folder (loader->_ci_view_path), to make Matchbox compitable with certain View libaries, in the latest versions. Might be more, can’t really remember. If you’re running without problems you might not need to update, however, I doubt you’ll have any issues doing so.
Don’t know about the routing though…
#293 / Mar 25, 2008 7:24am
will matchbox redirect to default controller when the controller called doesn’t exist?? or call default method when the method called doesn’t exist??
#294 / Mar 25, 2008 11:15am
No, it will not. Matchbox strives to work exactly like CodeIgniter on all other points except organization. This has the added benefit that frequent questions (like yours above) that have been solved with a standard CodeIgniter installation should be usable even with Matchbox running. Have a read on routes and controller remapping in the user guide or search the forums 😊
#295 / Mar 31, 2008 9:26am
Zacharias-
First, thanks for the license update! Second, I found one minor issue with the config loader. With my modules, I developed a kind of faux-plug-in system with them. To simplify things, Each module gets its own config file within its module folder. Now, if I name the config files differently everything is fine. But when I name them all the same, like “config.php” then only the first one will load.
I modified your MY_Config.php file to attach the module name to the filename in the $this->is_loaded array, which seems to solve the issue. Here’s how I modified the load function:
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
// {{{ Matchbox
$ci = &get;_instance();
$module = $ci->matchbox->argument(3);
$file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
if (in_array($module.$file, $this->is_loaded, TRUE)) // <---- Note the $module.$file here
{
return TRUE;
}
if (!$filepath = $ci->matchbox->find('config/' . $file . EXT, $module)) {
if ($fail_gracefully === true) {
return false;
}
show_error('The configuration file ' . $file . EXT . ' does not exist.');
}
include($filepath);
// }}}
if ( ! isset($config) OR ! is_array($config))
{
if ($fail_gracefully === TRUE)
{
return FALSE;
}
show_error('Your '.$file.EXT.' file does not appear to contain a valid configuration array.');
}
if ($use_sections === TRUE)
{
if (isset($this->config[$file]))
{
$this->config[$file] = array_merge($this->config[$file], $config);
}
else
{
$this->config[$file] = $config;
}
}
else
{
$this->config = array_merge($this->config, $config);
}
$this->is_loaded[] = $module.$file; // <---- Note the $module.$file here
unset($config);
log_message('debug', 'Config file loaded: config/'.$file.EXT);
return TRUE;
}Is this something you could address in an upcoming release? Thanks!
Ethan
#296 / Mar 31, 2008 10:56am
Ah, good catch. This might very well be a reoccuring issue within my code, as I’m pretty similar checks are made for several resources. Will definately be fixes as soon as possible.
#297 / Apr 01, 2008 8:48am
Hi Guys,
First thanks for this great module system I really like it. Makes application development so much easier to organise.
However, I’m having a problem with sub folders in modules.
If I place a controller called Test in the main module folder it works fine ie:
site.com/front/test
However when I move test to a sub folder it just shows a 404 error:
site.com/front/general/test
Any ideas why this isn’t working??
Thanks 😊
#298 / Apr 03, 2008 8:30am
@Zacharias: Have you got any idea when your Module Manager is completed? It would be great to learn from that code.
#299 / Apr 03, 2008 9:05am
Hello,
First of all, thanks for a greate tool!
I am just wondering if there is a way to use “local” routing for each module.
Like it is now I have to name the controller and functions so that the URL gets “clean”.
For example:
Module Name: Groups
Controller Name: Action
Function Name: archive
Like this: groups/action/archive/
I would like to shorten the URL.
Like this: groups/archive/
I think I can do this in the main router file but is it possible to use one
MY_Routing file for each module instead, makes it easier to package.
Thankful for all help!
#300 / Apr 09, 2008 9:37am
Sorry for the late response. 😊 You could also name your controller the same as the module. That way, you can omit the module name.
Module Name: Groups
Controller Name: Groups
Function Name: archive
groups/archive/