Re: How do I redirect?

2012-03-20 Thread glevine
AD7six,

Initially, I had a print statement before the redirect left over from when 
I was tracing the code path down to the header() call. After commenting out 
all print statements except the one in index(), I still don't successfully 
redirect. That print statement shouldn't be called until after the redirect 
has occurred. So unless you can explain why any output from index() would 
have an affect on the redirect, I think we can do without the condescending 
tone. Thanks

On Tuesday, March 20, 2012 3:22:36 AM UTC-4, AD7six wrote:



 On Tuesday, 20 March 2012 02:41:51 UTC+1, glevine wrote:

 @thatsgreat2345 That was just a typo.

 Commenting out the print statements in the change method has no effect. I 
 never see the in the index print statement and the browser simply shows a 
 blank page with a couple of warnings about changing the salt and cipherSeed.


  Read this aloud You can not send output to the webpage and then 
 redirect.

 AD


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How do I redirect?

2012-03-20 Thread glevine
Fair enough. My example was only to show that I was having trouble with 
reaching certain points in the code. I didn't want to write a lot of code 
for an example that didn't need to be overly complex to get the point 
across.

On Tuesday, March 20, 2012 6:23:29 AM UTC-4, pokerphp wrote:

 Also never do any output from the controller. If you still want to make it 
 nasty use something like 

  

   public function index()  {$nasty = 'in the index';
 $this-set('nasty', $nasty);  }

 then in the View/Tests/index.ctp
 ?php
   print $nasty;
 ?

 this will be way better than printing directly from the controller.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How do I redirect?

2012-03-20 Thread glevine
euromark,

No that stackoverflow post is not me. As I said previously, I'm not 
actually debugging with the code that I wrote above. I just posted an 
extremely rudimentary and flawed example to see if there was something 
outside of common sense that I was missing. The code I'm debugging doesn't 
print anywhere inside the method where the redirect happens. What's in 
index() shouldn't have any affect. If you must know, I have nothing in my 
index() method at the moment. I just want to see the url change, which it's 
not.

On Tuesday, March 20, 2012 8:43:35 AM UTC-4, euromark wrote:

 i sure hope its not the same guy:

 http://stackoverflow.com/questions/9763280/cakephp-2-0-upgrade-shell-redirect-faulty
  
 same time, same crazy idea

 guys. if you want to crappy debug here, use DIE();

 die('before redirect');
 $this-redirect(array('controller' = 'test', 'action' = 'index'));
 die('after redirect'); // totally nonsense, because it will NEVER reach 
 this point


 echo creates problems - and doesnt solve any!

 if you want to NOT crappy debug with redirects, use something else, like 
 log():

 $this-log('some log entry', 'test');

 and look into /tmp/logs/test.log




 Am Dienstag, 20. März 2012 11:23:29 UTC+1 schrieb pokerphp:

 Also never do any output from the controller. If you still want to make 
 it nasty use something like 

  

   public function index()  {$nasty = 'in the index';
 $this-set('nasty', $nasty);  }

 then in the View/Tests/index.ctp
 ?php
   print $nasty;
 ?

 this will be way better than printing directly from the controller.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How do I redirect?

2012-03-20 Thread glevine
In case anyone really cares, it was failing because the debugger was 
outputting warnings about changing the salt and cipherSeed configs. So that 
was the output that was being printed before the redirect which was giving 
me issues. Obviously I should have just taken care to do that sooner, but I 
was being lazy and assuming that problem was with my code and not the 
CakePHP library. Live 'n' learn.

On Sunday, March 18, 2012 10:28:02 PM UTC-4, glevine wrote:

 I have the following code:

 class TestsController extends AppController
 {
   public function index()
   {
 print 'in the index';
   }

   public function change()
   {
 print 'before redirect';
 $this-redirect(array('controller' = 'test', 'action' = 'index'));
 print 'after redirect';
   }
 }
  

 When I visit www.mysite.com/test/change/ I get a page with before 
 redirect and the URL is still 
 www.mysite.com/test/change/.http://www.mysite.com/test/change/I don't get 
 after redirect or in the index. What am I doing wrong?

 Thanks


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How do I redirect?

2012-03-19 Thread glevine
Right, so in the example I was mainly just wanting to show that I was 
reaching those points in the code. Theoretically, if I remove the print 
'before redirect'; statement then I should never see after redirect but 
I should see in the index upon the new page load (since that is post 
redirect).

For some reason, I was still unable to redirect when I wasn't printing to 
the screen before the call to exit. However, I may have just been tired and 
didn't realize I still had a print before exit. So I'll try again and 
respond back with the results.

Thanks

On Monday, March 19, 2012 7:56:28 AM UTC-4, euromark wrote:

 no you can't! or: you really shoudn't
 you should simply do everything before redirecting.

 theoretically, you can manually call exit() if you set the exit param to 
 false on redirect.
 but to me this makes no sense.


  can we do some process after redirect.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How do I redirect?

2012-03-19 Thread glevine
@thatsgreat2345 That was just a typo.

Commenting out the print statements in the change method has no effect. I 
never see the in the index print statement and the browser simply shows a 
blank page with a couple of warnings about changing the salt and 
cipherSeed. The url in the location bar remains 
http://www.example.com/tests/change.

On Monday, March 19, 2012 3:53:44 PM UTC-4, thatsgreat2345 wrote:

 Your problem is you are redirecting to test controller when in fact you 
 should be redirecting to tests controller.

 $this-redirect(array('controller' = 'tests', 'action' = 'index'));



 On Monday, March 19, 2012 7:56:09 AM UTC-7, glevine wrote:

 Right, so in the example I was mainly just wanting to show that I was 
 reaching those points in the code. Theoretically, if I remove the print 
 'before redirect'; statement then I should never see after redirect but 
 I should see in the index upon the new page load (since that is post 
 redirect).

 For some reason, I was still unable to redirect when I wasn't printing to 
 the screen before the call to exit. However, I may have just been tired and 
 didn't realize I still had a print before exit. So I'll try again and 
 respond back with the results.

 Thanks

 On Monday, March 19, 2012 7:56:28 AM UTC-4, euromark wrote:

 no you can't! or: you really shoudn't
 you should simply do everything before redirecting.

 theoretically, you can manually call exit() if you set the exit param to 
 false on redirect.
 but to me this makes no sense.


  can we do some process after redirect.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How do I redirect?

2012-03-18 Thread glevine
 

I have the following code:

class TestsController extends AppController
{
  public function index()
  {
print 'in the index';
  }

  public function change()
  {
print 'before redirect';
$this-redirect(array('controller' = 'test', 'action' = 'index'));
print 'after redirect';
  }
}
 

When I visit www.mysite.com/test/change/ I get a page with before 
redirect and the URL is still 
www.mysite.com/test/change/.http://www.mysite.com/test/change/I don't get 
after redirect or in the index. What am I doing wrong?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php