The Comment array is deeper than you think!
Use:
<?php
foreach( $task['Comment'] as $commentNo => $comment ) {
echo $comment['comment'];
}
?>
Enjoy,
John
On May 22, 7:24 am, programguru <[email protected]> wrote:
> I am trying to echo out my Comment data to my Task view file, and it will not
> work!
>
> Does anyone know if it is possible to print the [comment] field value? I am
> able to print all Task related items with for example <?php echo
> $task['Color']['name']; ?>. this works OK.
>
> But when I try to print: <?php echo $task['Comment']['comment']; ?> nothing
> will echo????? even though I can see my array with debug and all of the data
> is there?
>
> What am I doing wrong?
>
> [Color] => Array
> (
> [id] => 7
> [name] => productionTaskStatus
> )
>
> [Comment] => Array
> (
> [0] => Array
> (
> [id] => 1
> [comment] => this is a test comment
> [task_id] => 40
> )
>
> [1] => Array
> (
> [id] => 2
> [comment] => sdfsdfsdfds
> [task_id] => 40
> )
>
> [2] => Array
> (
> [id] => 3
> [comment] => this is a test comment
> [task_id] => 40
> )
>
> )
>
> )
>
> --
> View this message in
> context:http://www.nabble.com/Accessing-Array-Data-the-view-%28not-index%29-F...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---