(this page is translated by Google; We're working hard on a human translation)
Nette\Application\SimpleRouter
A simple two-way rue trivial for routing through the basic shape of the query string.
SimpleRouter is easily integrated interface IRouter . Has the same options as the route , ie generate and receive the URL address, set the flag for them to secure scheme ( https ) and one-way (the requirements are only accepted). But what of the route is not common is the ability to create "cool URLs" because SimpleRouter has as one of the parameters of the mask-shaped input / Output URL. You then have the classical shape of the query string.
SimpleRouter as well as the route at the beginning of its life cycle naparsuje input requirement (ie the query string) and it creates an object PresenterRequest as well as the route also generates URLs PresenterRequest this object, if it is bidirectional.
If the application is determined by any user defined rue, the default is used just SimpleRouter, which forwards the request to be processed presenter Default view and default .
Example SimpleRoutu Declaration and its transfer application:
// získáme objekt MultiRouter, který slouží jako úložiště pro routy
$router = Environment::getApplication()->getRouter();
// přidání dvousměrné routy do aplikace
$router [] = new SimpleRouter( array (
'module' => 'Front' ,
'presenter' => 'Article' ,
'action' => 'show' ,
'id' => NULL ,
));
// přidání jednoduché jednosměrné routy do aplikace
// je vhodné použít s nějakou další routou pro stejný
// modul a presenter, pokud z něj chceme i generovat odkazy
$router [] = new SimpleRouter( array (
'module' => 'Front' ,
'presenter' => 'Rss' ,
'action' => 'display' ,
), SimpleRouter::ONE_WAY);
// nebo příklad routy pro https schéma
$route = new SimpleRouter( array (
'module' => 'Admin' ,
'presenter' => 'Dashboard' ,
'action' => 'default' ,
'id' => NULL ,
), SimpleRouter::SECURED); A nice example of using SimpleRouteru in cooperation with the object in the directory PresenterRequest tests in the distribution.
See also:
- SimpleRouter API reference
- IRouter API reference
- Routing
- Route
- MultiRouter
- PresenterRequest
- Forum: Examples of router
- Forum: Routing Tips and Tricks



