How do I do a simple route in CakePHP?
I need that each and every URL will be routed by swapping the action and the controller. I just couldn't understand the placeholders syntax.
Example:
/files/read/3
to
/read/files/3
-- supplemental --
In my application I use aliases for the controllers.
and I want to route every url that have a certain keyword, as an action, to a certain controller.
I also want to provide the original controller name as a parameter.
Here is a 1:1 example:
There are to alises: fruits
and streets
.
The keyword that I want to catch in the action is find
.
The new controller name is finder
.
The following calls match my condition:/fruits/find/apple/red
and /streets/find/longer
The router should catch these urls and convert them, to:/finder/fruits/apple/red
(or supply the parameters in other way, I don't mind) and /finder/streets/longer
How should it be done?