mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
...
parent
b9af6730a6
commit
f832db5e1b
@ -10,6 +10,7 @@ Also, I wanted as little impact on a standard CodeIgniter installation, as every
|
||||
|
||||
|
||||
[b]Features:[/b]
|
||||
|
||||
- Location of your modules is configurable
|
||||
- Supports routing to a module controller
|
||||
- Supports cross module calls, also to controller methods
|
||||
@ -54,14 +55,33 @@ testhelper();[/code]
|
||||
|
||||
|
||||
[b]Routing:[/b]
|
||||
- work in progress -
|
||||
|
||||
Unlike other solutions, Modular CI doesn't use extensions of the Router library to allow routing to module controllers.
|
||||
|
||||
Instead, it uses a 'Modulerouter' controller, that utilizes the fact that controllers can call module controllers, to route to the requested module controller.
|
||||
|
||||
This solution has several benefits:
|
||||
- No modifications to the Router library
|
||||
- All CodeIgniter routing features are available to alter URI's
|
||||
- the Modulerouter has full access to the $CI superobject
|
||||
- You can use the Modulerouter constructor for authentication/autorisation tasks
|
||||
|
||||
Since the Modulerouter is a normal controller, you can name it whatever you want.
|
||||
|
||||
How does routing work? Very simple, just like any other route your would use. If your application is fully modular, and you like the straitforward way of the other solutions by starting your URI with the module name, you can use:
|
||||
[code]// you can choose to route all your standard application controllers first
|
||||
// and everything else to the module router
|
||||
$route['(welcome|test)(.*)'] = '$1$2'; // welcome.php and test.php are application controllers
|
||||
$route['(.*)'] = 'modulerouter/$1'; // everything is assumed to be a module[/code]
|
||||
|
||||
|
||||
[b]Download:[/b]
|
||||
|
||||
The latest version of the zip file can be found in the forum thread.
|
||||
|
||||
|
||||
[b]Discuss:[/b]
|
||||
|
||||
See this [url=http://codeigniter.com/forums/viewthread/164350/]forum thread[/url].
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user