¡Esta es una revisión vieja del documento!


Routing

What Are They? Routes allow you to make a specific page accessible via a unique URL.

Working With Routes Route configuration for your application can be changed by editing the application/configuration/routes.php file. If you open this up it should look something like this:

routes.php

namespace Salem;
Route::add(  
array( 
'/' => 'mycontroller.functionHandler' , //this refers to your __domain.com/__ that will be manage the petition by the application/controllers/mycontroller.php file and launch the functionHandeler() fun respectively.
'mypage','mycontroller.func', //in this case the function is called with a static argument, cause never change.
'query/:alpha/:int' => 'subfolder/othercontroller.getQuery' //dynamic route , multi-arguments and access to sub folder inside controller one
)//End of array
);
Let's say you had a page located at mycontroller/func/argument. Add that onto your domain name and you have a pretty long URL on your hands, so you want to be able to access that exact same page via the very small URL mypage. All you have to do is add a item into the array inside the routes.php file as above.

Now if you visit index.php/mypage you should see the exact same thing as if you visited index.php/mycontroller/func/argument.

Dynamic Routes It also allows you to use regular expressions in your routes. Salem take this easy to you, only need to know the type of “arguments” needed.

  • int (0,-1,2,…)
  • numeric (0.45,1, 3.33)
  • alpha (Luciano, Thoma, LucianoThoma)
  • alpha-numeric (Category2, Version5.5)
  • words (Adds - and 'blank space' from alpha-numeric)
  • extension (especific.pdf, some.doc)
  • any (talk by it own)

The above third route would cause you to see domain.com/query/test/123 equal as if you visited domain.com/index.php/one/test/123456.