On Dec 17, 3:30 pm, Dewayne Pinion <[email protected]> wrote:
> Ok, apparently I am braindead, because I am still not grasping the concept
> of a redirect in cake. I have this page:
>
>    productsadmin/compatibles/index/product_id:3365

Where does the above syntax come from (specifically the "product:3365"
part)? Typically, in CakePHP, arguments to an action are passed like
this:
app_name/contoller_name/action_name/argument_1/argument_2

>
> That has an edit link. Clicking on it takes me to this page:
>
>    productsadmin/compatibles/edit/4228

The above is typical of a CakePHP passed argument syntax.

>
> where I can edit the information for a related product.
>
> The update works fine. However, I would like to redirect back to:
>
>    productsadmin/compatibles/index/product_id:3365
>
> I currently have this in my controller:
>
>    $this->redirect(array('controller' => 'compatibles', 'action' => 'index',
> 'product_id' => $product_id));

Your syntax here is incorrect. See the CakePHP manual on redirect
here:
http://book.cakephp.org/view/425/redirect

To pass an argument to the action in a redirect it should look like
this (the third example on the manual page referenced above):
$this->redirect(array('controller'=>'controller_name',
'action'=>'action_name', argument_1));

Try either:
$this->redirect(array('controller' => 'compatibles', 'action' =>
'index', 'product_id:'.$product_id));
which should result in a URL like:
productsadmin/compatibles/index/product_id:3365

OR
$this->redirect(array('controller' => 'compatibles', 'action' =>
'index', $product_id));
which should result in a URL like:
productsadmin/compatibles/index/3365

I hope this helps,
Ken

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to