Hey mate! Thanks for your help but I solved the problem a couple of
hours ago. What I did was first get the items, then I simply extracted
the data, in this case the votes, from those items, then after that I
set a variable to the funciton in_array. Then depending on the outcome
of that the css file is set. Thanks for your help though !
On Jul 8, 5:21 pm, wralph <[EMAIL PROTECTED]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---