Router - notihnio/mgr GitHub Wiki

The Router Handles mgr’s url routing to modules, views, controllers. There are two different kinds of routers: the default and the normal.

Default Router

The default Router handles the first part of the requested url as the **module name**, the second as the the **controller name** and the third as the **action name**.

ex.

/admin/article/edit/id/3

return an array

admin =>Admin (Module)
article => ArticleController (Class name)
edit => EditAction (method of ArticleController)
params(
   id=> 3  (get parameter)
)

/admin/article/edit

admin =>Admin (Module)
article => ArticleController (Class name)
edit => EditAction (method of ArticleController)
action by default is index

/admin/article

admin =>Admin (Module)

article => ArticleController (Class name)
controller by default is IndexController
action by default is IndexAction

Normal Router

Normal Router is based on a user defined configuration array

array(
      "type" => "normal",
      "route" => "/article/:test/*",
      "controller" => "Articles",
      "action" =>"Index",
      "module" =>"Index",  
)

then the url /article/test/1 will fire up Index Module, ArticlesController and IndexAction and will pass a test=1 parameter

/* declares that we can pass other get parameters with default router logic

⚠️ **GitHub.com Fallback** ⚠️