display '0' if field exists, but not approved

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 28, 2011   (RSS)

Re: [Deborah] display '0' if field exists, but not approved

By Dave - February 27, 2011

Hi Deborah,

Try putting an if block below the foreach, like this:

<?php foreach ($commentsRecords3 as $record): // total number of approved comments ?>
<?php if ($record['status'] == "1"): ?>
<?php $recordsReturned = count ($commentsRecords3); ?>
<p class="subhd">comments (<?php echo ($commentsMetaData['totalRecords']); ?>)</p>
<?php endif ?>
<?php endforeach; ?>

<?php if (!$commentsRecords3): ?>
No Comments
<?php endif ?>


Let me know if that works for you. Thanks! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] display '0' if field exists, but not approved

By Deborah - February 28, 2011

Aha! I had tried an elseif, which didn't do the job.

Thanks for the solution, Dave!

~ Deborah

Re: [Deborah] display '0' if field exists, but not approved

By Dave - February 28, 2011

Glad to help! :)
Dave Edis - Senior Developer
interactivetools.com