Routing implementation details

From Joomla! Documentation

The "J2.5" namespace is a namespace scheduled to be archived. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Application Route Parsing[edit]

The Application execution order outlines that the route (URL) is parsed immediately after initialisation is complete. Since fancy URL's are not treated (yet) in the Administrator, we will follow the route parsing process in detail when JSite::route in the index.php file.

  • Call to JApplication::route
    • Clone the URI
    • Call to JApplication::getRouter
      • Call to JRouter::getInstance passing the type ("site")
    • Call to JRouterSite::parse passing the URI
      • Strip the suffix if applicable (added to $vars['format'])
      • Re-set the route (URI)
      • Call to JRouter::parse passing the URI
        • Call to JRouterSite::_processParseRules passing the URI (this will call custom route rules)
          • Call to JRouter::_processParseRules passing the URI
            • Call any custom routing rules (probably added via a system plugin using the onAfterInitialise event trigger) passing the URI
            • Returns an array of vars
          • If SEF mode, replace start variable with limitstart
        • If raw mode, call to JRouterSite::_parseRawRoute passing the URI
        • If SEF mode, call to JRouterSite::_parseSefRoute passing the URI
          • If the route (the URI path) is empty, load it from the default menu item; set the active menu item as the default
          • If first part is /component/com_content, set the option as the second segement. Null the Itemid.
          • Else, loop through menu alias values and take off segments that match as the menu tree is traversed. Set option and Itemid based on the last menu item found.
          • If the Itemid is set in the URL, set the active menu item based on this value.
          • Push the vars collected so far (eg, option, Itemid, etc) into the router object ($this).
          • If the route and option is set, load the component router;
          • Else, get the active menu item and get the route vars from it