Joomlager.de Joomla, PHP, etc. by Hannes Papenberg

While my updates were sparse, I haven't been idle in the last few weeks. The current situation is that the new routing classes are done and the old behavior has been put into rule classes, however this code is not backwards compatible yet.

JRouter has been reduced from 29 methods to 10 (those 19 methods have been left in but deprecated), and JRouterSite has been reduced to 2 methods from formerly 12. While the interface has been kept backwards compatible, the behavior has changed and this is where the problems set in. Is it still backwards compatible when the methods don't have the same effect as before? Right now, when you set the mode of the router between SEF and RAW, it changes the URLs. With the proposed changes, there is no mode anymore. It is just a changing set of rules that is applied to URLs. So I'm struggling on if and how this is B/C.

There is also the issue of the interface of rules. In the past, build-rules did not have a return-value while parse-rules did and in the new system, this has been unified so that both don't have a return-value. I think I have a sufficient solution for that, but it needs more testing.

Despite these issues, I'd like to give you a little insight on how this works right now. JRouterSite still extends JRouter, but it does not really override any methods anymore. Instead JRouterSite defines a set of rules that are added when the router is instantiated. It also takes an app- and menu-object that it provides to the rules, so that URLs for the frontend could be build both in front- and backend, depending on if you are able to get proper app- and menu-objects. JRouter then only provides a build() and parse() interface, which executes the different rules on the URLs. So JRouterSite is mostly empty and JRouter itself is pretty lean, too.

For the rules, there are two ways to add them to the system. Solution #1 would be a callback, that you can hand over to the router. Solution #2 is simply a rule-name, like "sef", which gets expanded into "JRouterRulesSef". That class should implement the JRouterRulesInterface and up till now, all those rules are autoloadable. Each rule provides a build() and a parse() method, which take the router and the URI object as parameters and can then modify them to their liking. Both objects are handed over as reference, so that the methods don't need a return value. While I could implement the rules as abstract classes, I decided to work with instantiated objects here, since this allows you to do some preliminary work like caching the menu or similar stuff.

I will try to keep you posted more often and as soon as the code is presentable, I will push it into my cloned Joomla-github repository. Thank you all for your patience, I definitely have not forgotten you.