Sunday, September 27, 2009

RE: Im dumb...help!

When I test it out I know there is no data for either.

So in the view:
<?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ?>
<h1>Dummy title</h1>
If info this should show up
<?php endif ?>

But sure enough in the view:
Dummy Title
If info this should show up

Cant figure out why the text is being rendered when both if conditions are
emtpy

Will try your suggestion.

Thanks

Dave

-----Original Message-----
From: Miles J [mailto:mileswjohnson@gmail.com]
Sent: September-27-09 7:27 PM
To: CakePHP
Subject: Re: Im dumb...help!


Thats correct, so what exactly is the problem?

If not try:

<?php if ((!empty($user['Post'])) || (!empty($user['Favorite']
['id']))) {

} ?>

On Sep 27, 2:51 pm, "Dave Maharaj :: WidePixels.com"
<d...@widepixels.com> wrote:
> I need to run an if on 2 conditions but I cant get it to work
>
> <?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ?>
> do something here if either is not empty
>
> && would check if both are empty but I need if either is not empty.
>
> How can I do this or what have I got done wrong here?
>
> thanks,
>
> Dave


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: