Joomla Routing and other frameworks and CMSs

143 views
Skip to first unread message

Edric Navarro (enav)

unread,
Dec 8, 2016, 7:54:44 PM12/8/16
to Joomla! CMS Development
Hello

I'm learning about Joomla! routing, What i love about Joomla! is that it uses the CMS pattern and it helps me understand other projects and frameworks easily. I wonder if Joomla! routing (build and parse) is similar to others CMSs or frameworks, I'm interested to know if what i learn from Joomla! routing may be useful in the future on other CMSs or Frameworks.

Thanks

Michael Babker

unread,
Dec 8, 2016, 8:20:07 PM12/8/16
to joomla-...@googlegroups.com
In terms of an absolute basic concept, the routing is similar.  Generally a URI is mapped to a controller task (referring to apps with an MVC pattern) which handles a request.  How that routing data is stored though is generally dependent on the routing architecture in use.  With the Joomla CMS, HEF URLs are mapped to the menu database table and has the mapping patterns mentioned above (the default URLs honestly don't need the menu table because each of the parameters is specified in the query string).  I'm fairly sure WordPress behaves similarly.

The standalone router package in the Joomla Framework takes a mapping array of URI to controller.  https://github.com/joomla/help.joomla.org/blob/master/src/Service/ApplicationProvider.php#L67-L82 demonstrates a simple use case where that particular application's routes are just added through the router's `addMap()` method.  Our issue tracker stores the mapping in JSON files for each "app" (component equivalent in the CMS), see https://github.com/joomla/jissues/blob/master/src/App/Tracker/routes.json as an example, and that mapping file is processed into the router in a similar way.

Symfony ultimately does something similar in terms of storing the routing data into the filesystem by default.  Using the Symfony Standard distro, you'll find a UrlMatcher object in the application's compiled cache which is a single file which was compiled from all of the route mapping sources that is used to process the routing step.  In general it's a much more complex routing system though (for example it supports things like defined defaults in the routing definition itself and uses named routes in its collection so your routing is a call to $router->generate('route_name', array('id' => 1)); compared to passing a non-SEF URI into JRoute::_()).

--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-cms+unsubscribe@googlegroups.com.
To post to this group, send email to joomla-dev-cms@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-cms.
For more options, visit https://groups.google.com/d/optout.

Edric Navarro (enav)

unread,
Dec 10, 2016, 11:30:54 AM12/10/16
to Joomla! CMS Development
Awesome explanation, thanks very much my friend

To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-cm...@googlegroups.com.
To post to this group, send email to joomla-...@googlegroups.com.

Dmitry Rekun

unread,
Dec 15, 2016, 4:36:06 AM12/15/16
to Joomla! CMS Development
Great explanation :)
Reply all
Reply to author
Forward
0 new messages