app_controller::redirect() version 0.2:

This one gives more consistent return--not sure what the problem was
before. 0.1 technically shouldn't have worked at all....

Here's 0.2:
<code type="php">
function redirect($url, $status = null)

{

        if ($this->RequestHandler->isAjax()) {

                $this->layout = 'ajax';

                echo $this->requestAction($url, array('return'));

                exit;

        } else {

                parent::redirect($url, $status);

        }

}
</code>

On 5/15/06, TheIdeaMan <[EMAIL PROTECTED]> wrote:
> Add this to your app_controller:
>
> <code type="php">
> function redirect($url, $status = null)
>
> {
>
>         if ($this->RequestHandler->isAjax()) {
>
>                 $this->layout = 'ajax';
>
>                 $this->requestAction($url);
>
>                 exit;
>
>         } else {
>
>                 parent::redirect($url, $status);
>
>         }
>
> }
> </code>
>
> That should do the trick.
>
> On 5/13/06, gwoo <[EMAIL PROTECTED]> wrote:
> >
> > There are a couple of options. One is in rdBloggery.
> > Also, search http://cakebake.wordpress.com
> > or maybe http://rossoft.wordpress.com/
> > those guys talked about this issue a while back.
> > the other more advanced option is to use the RequestHandler.
> > check in the beforeFilter if the request is coming from ajax
> > then do a redirect with /bare preceding the url that you want to
> > direct to.
> > using /bare before the controller in a request will give you the ajax
> > layout.
> >
> > Good Luck. Bake on....
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to