Welcome Guest, Not a member yet? Register   Sign In
CI Hack, Recess framework like dynamic routing
#1

[eluser]Unknown[/eluser]
Saw this
http://www.recessframework.org/blog

thought it looked cool, so I wrote up a quick hack to implement the basic idea

http://istillseeglaciers.com/MY_Router.phps

Issues:
Fantastically horrible hack to implement this, I ended up changing a couple lines in CodeIgniter.php despite my best efforts. I think I could fix this if I used a subprocess to build the routes, but I haven't done that yet.

Todo:
Add in caching to store routes cleaned from the controllers.
Unhaxor the CI

Add in dynamic context/behavior rules:
ex: `@isAjax` to tell the router that if a call to a method doesn't present itself as an ajax call then abort it.



Why:
Because its cool and I kind of liked the idea of embedding routes inside of my controllers instead of in a centralized config file.
#2

[eluser]xwero[/eluser]
I've seen it too and i liked it a lot.

The way i would add it is to write a hook function for it and add it to the presystem hook. The function generates the $route['regex'] = 'ci url'; lines for the routes.php file.

While developing you can leave the hook in, which will render the pages slower, but you will have instant routes. For production you remove the hook.

But i also was thinking about another way of adding the routes

Code:
function fantastic() /* custom/route */
This way you can regex the lines instead of using all kinds of other parse functions.

Maybe this gives you so ideas.




Theme © iAndrew 2016 - Forum software by © MyBB