Re: Custom Component and Redirect problem
I figure out now. There is some funny character in my Date component. That's why it screw up the header for redirect. Thank you for everyone input. I love the CakePhp community. On Feb 8, 11:26 am, Micro <[EMAIL PROTECTED]> wrote: > Ok, I try to remove all the print out and stuff, but, i still get the > same error. > > class TradesController extends AppController { > > var $name = 'Trades'; > var $components = array('Date'); > var $helpers = array('Html', 'Form'); > >function index() { > > } > >function add() { > $this->redirect(array('action'=>'index')); > } > > } > > On Feb 7, 5:09 pm, "Kjell Bublitz" <[EMAIL PROTECTED]> wrote: > > > If you just wanna test if the timestamp is there, you can simply "exit" > > before doing the redirect(). > > > You could just do this: pr($timeStamp); exit(); if you expect an array.. if > > you expect just a string exit($timeStamp); will do the same trick.. as an > > alternative to pr() which is just the print_r() output with a tag > > around it, you can use var_dump($timeStamp); to get more details. > > > If you are happy with the results, remove the exit() and continue.. > > > Another way is to take a decent remote debugger with an IDE that uses it. > > That way you can save yourself from doing all that print_r and echo stuff.. > > > Good IDEs are Zend Studio and Komodo Pro. > > > HTH, > > Kjell > > > On Feb 7, 2008 11:43 PM, Micro <[EMAIL PROTECTED]> wrote: > > > > I am using CakePhp 1.2 So, I created a component called Date. I > > > embedded in my class following the example. > > > > My controller class: > > > > class TradesController extends AppController { > > > >var $name = 'Trades'; > > >var $components = array('Date'); > > >var $helpers = array('Html', 'Form'); > > > > function index() { > > > >} > > > > function add() { > > >$timeStamp = $this->Date->getTimestamp(); > > > print_r($timeStamp); > > >$this->redirect(array('action'=>'index')); > > > } > > > > } > > > > I get this error > > > > Warning (2): Cannot modify header information - headers already sent > > > by (output started at C:\xampplite\htdocs\cake12\app\controllers > > > \components\date.php:119) [CORE\cake\libs\controller\controller.php, > > > line 546] > > > > If I uncomment the $this->redirect(array('action'=>'index')), my > > > component works perfectly fine, and i don't get any error. I try to > > > comment out the component part, and it works fine. The problem only > > > occurs when I use my custom component and has the redirect line. Any > > > clue? Thank you. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Custom Component and Redirect problem
Ok, I try to remove all the print out and stuff, but, i still get the same error. class TradesController extends AppController { var $name = 'Trades'; var $components = array('Date'); var $helpers = array('Html', 'Form'); function index() { } function add() { $this->redirect(array('action'=>'index')); } } On Feb 7, 5:09 pm, "Kjell Bublitz" <[EMAIL PROTECTED]> wrote: > If you just wanna test if the timestamp is there, you can simply "exit" > before doing the redirect(). > > You could just do this: pr($timeStamp); exit(); if you expect an array.. if > you expect just a string exit($timeStamp); will do the same trick.. as an > alternative to pr() which is just the print_r() output with a tag > around it, you can use var_dump($timeStamp); to get more details. > > If you are happy with the results, remove the exit() and continue.. > > Another way is to take a decent remote debugger with an IDE that uses it. > That way you can save yourself from doing all that print_r and echo stuff.. > > Good IDEs are Zend Studio and Komodo Pro. > > HTH, > Kjell > > On Feb 7, 2008 11:43 PM, Micro <[EMAIL PROTECTED]> wrote: > > > > > I am using CakePhp 1.2 So, I created a component called Date. I > > embedded in my class following the example. > > > My controller class: > > > class TradesController extends AppController { > > >var $name = 'Trades'; > >var $components = array('Date'); > >var $helpers = array('Html', 'Form'); > > > function index() { > > >} > > > function add() { > >$timeStamp = $this->Date->getTimestamp(); > > print_r($timeStamp); > >$this->redirect(array('action'=>'index')); > > } > > > } > > > I get this error > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at C:\xampplite\htdocs\cake12\app\controllers > > \components\date.php:119) [CORE\cake\libs\controller\controller.php, > > line 546] > > > If I uncomment the $this->redirect(array('action'=>'index')), my > > component works perfectly fine, and i don't get any error. I try to > > comment out the component part, and it works fine. The problem only > > occurs when I use my custom component and has the redirect line. Any > > clue? Thank you. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Custom Component and Redirect problem
If you just wanna test if the timestamp is there, you can simply "exit" before doing the redirect(). You could just do this: pr($timeStamp); exit(); if you expect an array.. if you expect just a string exit($timeStamp); will do the same trick.. as an alternative to pr() which is just the print_r() output with a tag around it, you can use var_dump($timeStamp); to get more details. If you are happy with the results, remove the exit() and continue.. Another way is to take a decent remote debugger with an IDE that uses it. That way you can save yourself from doing all that print_r and echo stuff.. Good IDEs are Zend Studio and Komodo Pro. HTH, Kjell On Feb 7, 2008 11:43 PM, Micro <[EMAIL PROTECTED]> wrote: > > I am using CakePhp 1.2 So, I created a component called Date. I > embedded in my class following the example. > > My controller class: > > class TradesController extends AppController { > >var $name = 'Trades'; >var $components = array('Date'); >var $helpers = array('Html', 'Form'); > > function index() { > >} > > function add() { >$timeStamp = $this->Date->getTimestamp(); > print_r($timeStamp); >$this->redirect(array('action'=>'index')); > } > > } > > I get this error > > Warning (2): Cannot modify header information - headers already sent > by (output started at C:\xampplite\htdocs\cake12\app\controllers > \components\date.php:119) [CORE\cake\libs\controller\controller.php, > line 546] > > > If I uncomment the $this->redirect(array('action'=>'index')), my > component works perfectly fine, and i don't get any error. I try to > comment out the component part, and it works fine. The problem only > occurs when I use my custom component and has the redirect line. Any > clue? Thank you. > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Custom Component and Redirect problem
El 07/02/2008, a las 23:43, Micro escribió: > If I uncomment the $this->redirect(array('action'=>'index')), my > component works perfectly fine, and i don't get any error. I try to > comment out the component part, and it works fine. The problem only > occurs when I use my custom component and has the redirect line. Any > clue? Redirect sends headers, and you has just printed a result. You have to rethink the code. -- Fran Iglesias [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Custom Component and Redirect problem
I am using CakePhp 1.2 So, I created a component called Date. I embedded in my class following the example. My controller class: class TradesController extends AppController { var $name = 'Trades'; var $components = array('Date'); var $helpers = array('Html', 'Form'); function index() { } function add() { $timeStamp = $this->Date->getTimestamp(); print_r($timeStamp); $this->redirect(array('action'=>'index')); } } I get this error Warning (2): Cannot modify header information - headers already sent by (output started at C:\xampplite\htdocs\cake12\app\controllers \components\date.php:119) [CORE\cake\libs\controller\controller.php, line 546] If I uncomment the $this->redirect(array('action'=>'index')), my component works perfectly fine, and i don't get any error. I try to comment out the component part, and it works fine. The problem only occurs when I use my custom component and has the redirect line. Any clue? Thank you. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---