Thursday, February 26, 2009

Routing passing non-route variables to actions

In my application, I want the route /user/Homer/robots to show all
Homer's robots, wich are retrieved by the action get_robots from
users_controller.

The problem is that get_robots has some variables that are not passed
in the route:

function get_robots($model = null, $id = null, $show_all = true)

So, what can I do to give a value to $model and $show_all through the
routing (the $id will be Homer).

The (incomplete) entry in routes.php is:

Router::connect('/user/:username/robots',
array('controller' => 'users', 'action' => 'get_robots'),
array('pass' => array('username'),
'username' => '[0-9a-zA-Z]*'
)
);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: