Totally Zenned
- Join Date:
- Aug 2005
- Location:
- Trujillo Alto, Puerto Rico
- Posts:
- 1,437
- Plugin Contributions:
- 3
An "if" statement
Hello my php nerdy friends, can someone tell me how do I change this code to make it to show up ONLY when there's a review present:
<?php
echo '<p class="reviewCount">';
if ($flag_show_product_info_reviews_count == 1) {
echo TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
$stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
$average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
echo TEXT_CURRENT_REVIEWS_RATING . ' <strong>' . $average_rating . '</strong> ' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));
} else {
echo '';
}
echo '</p>';
I know I have to insert something like:
if ($reviews->fields['count'] > 0 ) { ?>
I just don't know where and how exactly. :unsure:
Thanks in advance!