You could write a component for checking if the user_id is contained
in the data array. So something like:
<?php
class VoteInfoComponent extends Object
{
function userVoted($data, $userid)
{
if (is_array($data) )
{
foreach($data as $story)
{
foreach($story as $votes)
{
if ($votes['user_id'] == $userid) return 1;
}
}
}
return 0;
}
}
?>
I haven't tested the above! Include this in your controller and then
call as
$this->voteinfo->userVoted($data, 74);
It would be easy to extend this to check if a user responsed to a
particular story.
Also you have an error in the following:
<?php $user ? 'returnedtruecss' : 'returnedfalsecss'; ?>
should be
<?php echo $user ? 'returnedtruecss' : 'returnedfalsecss'; ?>
Winston
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---