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 <pre> 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to