Prev | Current Page 764 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

tpl"}
8. Add the following styles at the end of tshirtshop.css:
.reviews-list li {
background: #ccddff;
border-bottom: #fff solid 3px;
display: block;
padding: 5px;
}
.review-table {
width: 100%;
}
.review-table tr td {
border: none;
}
.add-review {
background: #e6e6e6;
padding: 5px;
}
9. Load tshirtshop in your browser, and click a product to view its product details page. If we??™re not logged
in and the product has no reviews, we??™ll see the output shown in Figure 21-2. A sample output for a product
that has one review was presented in Figure 21-1.
How It Works: The Reviews Componentized Template
The reviews componentized template takes care of both displaying the reviews and adding a new review. The first
part of the reviews.tpl file determines whether we have any reviews to display for the current product. If we
don??™t, a short message appears encouraging your visitor to write the first review.
{if $obj->mTotalReviews != 0}

Customer reviews:


[a list with reviews]
{else}

Be the first person to voice your opinion!


{/if}
The second part of the template displays a form to add a review or a message that invites the visitor to log in to be
able to add a review:
{if $obj->mEnableAddProductReviewForm}
{* add review form *}

Add a review:


[add review form]
CHAPTER 21 ?–  PRODUCT REVIEWS 662
{else}

You must log in to add a review.


Pages:
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776

wciągarki linowe imprezy integracyjne dla firm sterowniki drukarek William Hill Poker wyposażenie siłowni