Part of the EllisLab Network
   
2 of 36
2
Matchbox 0.9.4
Posted: 26 November 2007 03:21 AM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  490
Joined  06-16-2006

gerben, I found out that I might actually be able to make modules in places other than APPPATH that can also load controllers, I’ll find out. I’m thinking of adding an config file where you have an array of places to look for modules (since some people won’t need the BASEPATH and some might to store them in the root).

Regarding the manager. xwero: setting up and removing related database tables was the first reason i started thinking about a module manager. However I’m unsure of how feature heavy it should be. I mean I could stuff it but developer might be annoyed with the extra work required to make a matchbox module.

I was considering making a module interface that uses a matchbox library for most of it’s functionality so developers could load that library and use it for their own module manager (with their own authentication and layout) and just disable the standard one.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 26 November 2007 03:40 AM   [ Ignore ]   [ # 12 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  3104
Joined  07-14-2006

Maybe there should be a database config file so that developers can adjust the tables/fields for each site they add the module to. You never know if you can start from scratch or that you have to use existing tables. The problem is how to give maximum flexibility and keep it programmable.

Profile
 
 
Posted: 26 November 2007 08:45 AM   [ Ignore ]   [ # 13 ]  
Grad Student
Rank
Total Posts:  87
Joined  08-23-2007
gerben, I found out that I might actually be able to make modules in places other than APPPATH that can also load controllers, I’ll find out. I’m thinking of adding an config file where you have an array of places to look for modules (since some people won’t need the BASEPATH and some might to store them in the root).

Cool! I thought it had to be possible, because I already run all sorts of CI stuff from outside of the application/system folders.

A config file would be marvelous, and make the module manager very flexible. A nice side-effect would also be that you can have different kinds of modules in different places. Yesterday I managed to load a module as a widget (so it can be dragged around anywhere in the layout), and with a config-file I could have seperate folders for normal modules and widget-modules.

As for a table-installer: you can first keep it simple by letting module-designers just create an install.php which contains all queries, and then call it from the admin-panel.

Profile
 
 
Posted: 26 November 2007 01:42 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  490
Joined  06-16-2006

xwero: I think that enabling table/field custamization is up to the programmers of the modules to get right. I mean if the table names are hardcoded they will be hard to custamize. However, I will encourage not doing so on my “Standards” wiki page if/when I get the manager done.

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). About the table-installer in the module manager, what I am doing is giving developers the opportunity to include and modulename_module.php file with methods like install(), remove(), etc. So developers could easily put table creation in there as well as some pre installation configuration forms.

I also updated a few files so they’ll be compatible with CI 1.5.5.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 27 November 2007 08:32 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  4
Joined  09-17-2007

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 smile

Profile
 
 
Posted: 27 November 2007 08:36 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  490
Joined  06-16-2006

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://codeigniter.com/forums/viewthread/55212/

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 27 November 2007 10:57 AM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  490
Joined  06-16-2006

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/.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 29 November 2007 06:10 AM   [ Ignore ]   [ # 18 ]  
Summer Student
Avatar
Total Posts:  16
Joined  04-06-2006

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

Profile
 
 
Posted: 29 November 2007 07:11 AM   [ Ignore ]   [ # 19 ]  
Summer Student
Avatar
Total Posts:  16
Joined  04-06-2006

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;
}

Profile
 
 
Posted: 29 November 2007 07:22 AM   [ Ignore ]   [ # 20 ]  
Summer Student
Avatar
Total Posts:  16
Joined  04-06-2006

Post #1 here:
http://codeigniter.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.

Profile
 
 
   
2 of 36
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 62402 Total Logged-in Users: 34
Total Topics: 76628 Total Anonymous Users: 4
Total Replies: 413874 Total Guests: 455
Total Posts: 490502    
Members ( View Memberlist )