The main difference is reverse routing.
Defining a specific route syntax for a given controller/action and
using the array method will make the correct url.
Let's say you have
`Router::connect('/catalogue/c/*', array('controller' => 'categories',
'action' => 'view'));`
`Router::connect('/catalogue/p/*', array('controller' => 'products',
'action' => 'view'));`
Then you do
`$html->link('Link', array('controller' => 'products', 'action' =>
'view', 123));`
The result will be `/catalogue/p/123`
Whereas if you do
`$html->link('Link', '/products/view/123')`
The result will be `/products/view/123`, which doesn't correspond to
your route.
hth
grigri
On Jan 5, 10:56 am, gearvOsh <[email protected]> wrote:
> Are there any benefits, or behind the scenes magic for doing this:
>
> $html->link('Link', array('controller' => 'users', 'action' =>
> 'login', 'var'));
>
> Compared to:
>
> $html->link('Link', '/users/login/var/');
>
> This also applies to anywhere else you build urls.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---