CICON2010 - Modular CI |
[eluser]gyo[/eluser]
Actually I wasn't sure if 'modules' were intended to be separate from the main CI application, or better stand-alone. Now it makes sense. What I mean is that with URI routing, the whole story would even be more flexible and interesting. And a developer can use it or not, depending on the needs. What do you think?
[eluser]Dan Horrigan[/eluser]
WanWizard, Nice concept I am working on something similar for Pancake (http://pancakeapp.com). We are going to be using a combo of modules and packages in a very unique way. MAY open source it...not sure yet. Anyway, why are you using the _assign_libraries() function? Why not use a __get()? EDIT: Nevermind...i see you are already using __get for loading the libraries. Dan
[eluser]WanWizard[/eluser]
[quote author="gyo / suashi" date="1282146658"]What I mean is that with URI routing, the whole story would even be more flexible and interesting. And a developer can use it or not, depending on the needs. What do you think?[/quote] Possible, but that whould either mean a major rewrite of the CI core code, massive hook 'work', or using a fixed controller, and do the routing in there. I have to think about something clever that doesn't need major CI modifications... If you have a URI like "/sectionA/sectionB/sectionC/sectionD/sectionE", you could have: 1) sectionA is a controller, section B is a method, the rest are URI segments 2) sectionA is a controller folder, section B is a controller, sectionC is a method, the rest are URI segments 3) sectionA is a module, section B is a controller, sectionC is a method, the rest are URI segments 4) sectionA is a module, section B is a controller folder, sectionC is a controller, sectionD is a method, the rest are URI segments Routing should be able to handle all these situations, and also deal with duplicates properly. For example, if in a standard CI installation you have a controller called "Test", and you have a controller folder called "Test", nothing in that folder is accessable because CI checks for a controller first. Preferrably it should check from situation 4) to 1), to allow all possibilities. I'll have a look, first a conversion into using $this->load->module() (seems more natural to use this), and support for language files (forgot that).
[eluser]WanWizard[/eluser]
New version is available (funny, now uploading works again). Modifications: - modules live by default in the application folder * can be altered by calling $this->load->module_path(); - modules are now loaded via $this->load->module() * this requires a MY_Loader extension, merge it if you already have one. - as per request: you can now route to module controllers * no code modification, requires only adding a route to config/routes.php! Code: // you can choose to route all your standard application controllers first - when using routing, controllers now support the _remap() method There is an example module included, and a Test controller to test the module functionality. The URL http://example.org/example/example_contr.../varY/varZ will route to the controller example_controller in the example module (will call _remap(), since it exists. Remove it to test calling a method). The URL http://example.org/test should output: Quote:Calling: $this->example->library->example_library->example('varA', 'varB');
[eluser]WanWizard[/eluser]
It suddenly dawned to me that there wasn't a lot of specific 2.0 code in here, so I made it work in 1.7.2 as well...
[eluser]WanWizard[/eluser]
Moved this solution to the Wiki. A new version of Modular CI is now available for download from the Wiki. This version introduces full routing support for module controller, using standard CI routing rules, and without any restriction to the format of your rules. If you like to discuss this solution, if you have comments or feature requests, please start a wiki discussion!
[eluser]eokorie[/eluser]
This sounds like a great solution for some of the issues I have encountered with other modular plugins for CI. Will this also support config files in modules? Great job by the way!
[eluser]Jônatan fróes[/eluser]
You're doing a great work... I'll try it today! |
Welcome Guest, Not a member yet? Register Sign In |