How can I name a route (in a view) in CakePHP in the same way in Rails?
Ruby on Rails
routes.rb
map.my_route '/my-route', :controller => 'my_controller', :action => 'index'
View
link_to 'My Route Name', my_route_path
Cakephp
routes.php
Router::connect('/my-route', array('controller' => 'my_controller', 'action' => 'index'));
View
$html->link('My Route Name', '/my-route');
I think the Rails path is better, because I can make changes to the "url", and I don't need the code changes of all views.
source
share