Skip to content
flack edited this page Dec 8, 2016 · 13 revisions

Routing in MidCOM is based on Topics, which gives you a lot of flexibility in how you structure your site's URL space. If your topic tree looks like this:

root
  news
     blog
  aboutus
     company

Then a URL like /news/blog/latest/5/ would be resolved to the topic with the name blog. At this point, the topic's component takes over, and tries to map the remaining URL (in this case latest/5/) to a handler inside the component. Which routes can be handled by a component is determined in the routes.inc file in the component's config directory. A typical routes definition might look like this:

'latest' => array(
    'handler' => array('net_nehmer_blog_handler_index', 'index'),
    'fixed_args' => 'latest',
    'variable_args' => 1,
),

So with the given URL, the handler class net_nehmer_blog_handler_index would get instantiated, and the method _handler_index will be called. Everything that matches variable_args (in this example, 5) get passed to _handler_index in the $args parameter

Clone this wiki locally