Reputation: 348
I have two URLs for one action and each should generate different views.
e.g.: /abc -> connects with controller x, action y, view = 0
/def -> connects with controller x, action y, view = 1
this works fine with
Router::connect('/abc', array('controller' => 'x 'action' => 'y', 'view' => 0));
Router::connect('/def', array('controller' => 'x 'action' => 'y', 'view' => 1));
but now there is that problem:
I have a formular, which should send its data to /def or /abc. How can I manually set, which route should be used?
edit:
$form->create('Model', array('url' => array('action' => 'index', 'view' => '1'))); // def
$form->create('Model', array('url' => array('action' => 'index', 'view' => '0'))); // abc
both leads me to /controller/index and not to /def or /abc
Upvotes: 1
Views: 513
Reputation: 7585
Router::connect('/def', array('controller' => 'x' action' => 'y', 'view' => 1), array('pass' => array('view')));
then
if($this->params['view']){
// its 1
} else{
//its 0
}
Upvotes: 2