wohoo!
i love
minimal
Joomla!

Joomla 1.7: Rewrite JRouter

JRouter is the class to manage the routing inside of Joomla to determine which menu item, component and content item to load. This class is currently not consistently coded. JRouter allows you to attach additional rules, but otherwise is static in the way it handles URLs. I've rewritten this class to make it faster, more generic and easier to extend.

First of all, all behaviors of JRouter are now seperate rules, which means that they can be attached, detached and replaced whichever way you want. It also means, that JRouter is identical for all applications. The difference is, that you attach application specific rules instead of having that hard coded in your application specific JRouter class.

The second improvement is a change of the input data. JRouter currently takes URL strings, which it parses several times and re-arranges, returning it again as a string. Before that URL string is created, a developer (normally) has arrays with data, which he then converts to a string, which, in JRouter, is again converted to an array. My rewrite now accepts both a string and an associative array, which makes it easier to create the URLs and it makes the whole run of JRouter noticeably faster.

With this rewrite, changing the behavior and getting for example Wordpress styled URLs, is not a matter of rewriting the whole JRouter class, but only means that a plugin needs to attach a new rule.

Attached is a zipped patch with the changes that I'd like to propose for 1.7


blog comments powered by Disqus