Tuesday, November 13, 2012

Re: Parsed url / Redirect - base issue

Yes, the array'ed redirects work properly. The thing is that redirect() obivously expects a APP RELATIVE path (if a string is given).

But I have no way to generate an app-relative url string (without a base). At least as far as I know... :D

This is the current "patch":

                $return = Router::url(array('controller' => 'orders', 'action' => 'index')); //just for explanatory purposes..
        $url = ($this->request->is('HTTPS') ? 'https://' : 'http://') . env('SERVER_NAME') . $return;
        $this->redirect($url);

Which is fugly.

I basically need a "quickAction" thingie, which goes like:

URL: /app-name/orders/do/cancel/5?goTo=/orders/
This calls OrdersController->admin_do('cancel', 5)
Which redirects to the goTo query variable when finished.

But when I generate the link:
$goTo = Router::url(array('controller' => 'orders', 'action' => 'edit', 655)); //or whatever
$url = Router::url(array('controller' => 'orders', 'action' => 'do', 'cancel', 5 , '?' => array('goTo' => $goTo)));
The $url is then "/app-name/orders/do/cancel/5?goto=/app-name/orders/edit/655"
I need the $goTo to be without the base path. (/orders/edit/655)

Is there possibly a more conventional way of doing this same thing in Cake?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: