3

In Joomla! documentation it is stated that:

Since Joomla 3.3, one should rather implement the interface JComponentRouterInterface and handle the routing and parsing similar as below, but via the methods of this interface.

But I cannot find any sample implementation of the interface mentioned above. Can anyone provide an example?

https://docs.joomla.org/Supporting_SEF_URLs_in_your_component

1 Answer 1

3

In the old days, the router.php file contained functions: BuildRoute and ParseRoute. Nowadays, if you look at the router.php of the banners extension for example, you will see a class called BannersRouter which extends from JComponentRouterBase, and within that class you will see the build and the parse functions. Additionally, just immediately after the class, you will also see the bannersBuildRoute and the bannersParseRoute functions (these 2 functions are necessary and will invoke the build and the parse methods).

So, in your router.php, once you use a class that extends from JComponentRouterBase (like the banners component), instead of just using BuildRoute and ParseRoute, then you are automatically implementing the JComponentRouterInterface in your component.

Hope this helps!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.