2. About me
• Hannes Papenberg
• Joomla Freelancer
• Longtime Joomla contributor
• Münster, Germany
• https://www.joomlager.de
3. What are we covering?
• Update your old component router
• Modify existing routers for your site
• What not to do anymore
Important: Ask!
4. Format for new Component Routers
Reminder of the past:
function contentBuildRoute(&$query) { ... }
function contentParseRoute($segments) { ... }
5. Format for new Component Routers
New Format
Class named <Component>Router
implementing
JoomlaCMSComponentRouterRouterInterf
ace
Easy shortcut: extend
JoomlaCMSComponentRouterRouterBase
6. Format for new Component Routers
• preprocess($query) - Cleanup URL
• build(&$query) - Build SEF URL
• parse(&$segments) - Parse SEF URL
7. Use the advanced new Component
Routers
• Extend from
JoomlaCMSComponentRouterRouterView
• Register the views of your component
• Create get<View>Segment() methods
• Create get<View>Id() methods
• Attach routing rules
8. Inject your own behavior into the site router
JoomlaCMSRouterRouter::attachBuildRule();
JoomlaCMSRouterRouter::attachParseRule();
9. ... or the component router!
• $crouter = $router-
>getComponentRouter(<component>);
• $crouter->attachRule();
• $crouter->detachRule();
• $router->setComponentRouter($crouter2);
10. What not to do anymore!
• Don't add the Itemid to static links
• Don't calculate the Itemid outside of the
component router
• Don't add the Itemid to the URL in
*HelperRoute classes
Or in short: No Itemid outside of the router.
11. History of this feature
• 2009: First implementations
• 2012-2014: Several unsuccessfull attempts to
get attention for this feature
• 2014: crowdfunding campaign
• 2017: Last changes released as part of 3.8
12. Thanks to the contributors
I want to thank the contributors of the
crowdfunding campaign:
https://www.joomlager.de/de/crowdfunding/
contributors