Re: NEWBIE QUESTION: code continues executing after this->redirect()?
Thanks to all for the helpful responses. Adding exit(0) fixed my problem, and I will also consider a return. Jim http://www.biochartonline.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
A return would make more sense than an exit I suppose.Thanks for the explanations.On 6/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: John Zimmerman [gmail] wrote:> Is there a situation where you would not want to exit after a redirect? For> myself I cannot think of any.afterFilter won't be called if you do an exit or die. Now, I've never yet had to use afterFilter, but I try to structure sothat I can in the future. So the most I ever do after a redirect orrender is a return, ending method execution. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
John Zimmerman [gmail] wrote: > Is there a situation where you would not want to exit after a redirect? For > myself I cannot think of any. afterFilter won't be called if you do an exit or die. Now, I've never yet had to use afterFilter, but I try to structure so that I can in the future. So the most I ever do after a redirect or render is a return, ending method execution. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
John Zimmerman [gmail] wrote: > Is there a situation where you would not want to exit after a redirect? For > myself I cannot think of any. > Well, while all modern browsers do actually redirect (by transparently requesting the new location), it is recommended by the W3C that you actually include a "hypertext note" informing the user of the redirection. I guess this is for the odd occasion where the redirection is not automatically followed. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html How relevant this is in today's web, I don't know. But that would be the reason for a redirect not to exit() automatically. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
I haven't done too much with AJAX, but would the addition of exit to redirect functionality mess up an AJAX or Request Action call?On 6/27/06, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote: On Jun 27, 2006, at 1:18 PM, John Zimmerman [gmail] wrote:> Not really a big deal, but upon first use I expected it to not> continue executing the script where the redirect was called.I'm not sure what the verdict would be on your proposed change (best to log an RFC ticket on Trac), but in the meantime, you could writeyour own redirect() function in the AppController that does whatyou've just described.-- J --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
On Jun 27, 2006, at 1:18 PM, John Zimmerman [gmail] wrote: > Not really a big deal, but upon first use I expected it to not > continue executing the script where the redirect was called. I'm not sure what the verdict would be on your proposed change (best to log an RFC ticket on Trac), but in the meantime, you could write your own redirect() function in the AppController that does what you've just described. -- J --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
I have been performing an exit() after my redirects as well, as this is what I had to do with header('Location: url'); calls before CakePHP; "B.C." :-).Is there a situation where you would not want to exit after a redirect? For myself I cannot think of any. If there is not a reasonable situation to not exit after redirect, and there is alternate functionality for a legitimate situation, is it possible to include the exit call at the end of the redirect functionality? Not really a big deal, but upon first use I expected it to not continue executing the script where the redirect was called.-JohnOn 6/27/06, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote: On Jun 27, 2006, at 12:54 PM, jbernat wrote:>> I am new to PHP and Cake. I am baking my first website with Cake and> have implemented authentication as per the manual at> http://manual.cakephp.org/chapter/19 .The example presented is very loose, and is only meant as a way toshow you how to roll your own authentication, or integrate your Cakeapp with something else. > If I wish to abandon all further method execution, what do I need to> call or execute following this->redirect()?exit(0);-- John --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: NEWBIE QUESTION: code continues executing after this->redirect()?
On Jun 27, 2006, at 12:54 PM, jbernat wrote: > > I am new to PHP and Cake. I am baking my first website with Cake and > have implemented authentication as per the manual at > http://manual.cakephp.org/chapter/19 . The example presented is very loose, and is only meant as a way to show you how to roll your own authentication, or integrate your Cake app with something else. > If I wish to abandon all further method execution, what do I need to > call or execute following this->redirect()? exit(0); -- John --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
NEWBIE QUESTION: code continues executing after this->redirect()?
I am new to PHP and Cake. I am baking my first website with Cake and have implemented authentication as per the manual at http://manual.cakephp.org/chapter/19 . I added the call to CheckSession() to each of the methods in my controller that require authentication, but noticed that even if the person is not logged in, the method executes. Upon stepping through the code, I noticed that the this->redirect() which forwards them to the login page falls through and the code after resumes executing. Is this as you would expect? I was expecting it would behave like an ASP Response.Redirect() which terminates the current script. If I wish to abandon all further method execution, what do I need to call or execute following this->redirect()? Many thanks! Jim Bernatowicz http://www.photips.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---