How to use rating 'stars' in article summaries
ladyofdragons <[email protected]> Mon, 13 Oct 2003 18:42:10 -0400
| Newsgroups | gmane.comp.cms.xaraya.knowledge-base |
|---|---|
| Organization | xaraya.com |
| Message-ID | <[email protected]> |
Posting this because I just figured out how. To show images in an article
summary, rather than the rating number, place this into your user-summary-
pubtype.xt (or .xd):
<!-- only show this if there is a rating at all -->
<xar:if condition="$rating gt 0">
<!-- this shows full stars -->
<xar:for start="$i = 1" test="$i le ($rating/20)" iter="$i++">
<img src="modules/ratings/xarimages/rate_full.gif" alt="star" />
</xar:for>
<!-- this shows the half star if there is one-->
<xar:if condition="($rating % 20) ge 5">
<img src="modules/ratings/xarimages/rate_half.gif" alt="half star" />
</xar:if>
<xar:if condition="$rating lt 100">
<!-- this part is optional, to always show the total spacing of stars. -
->
<xar:for start="$i = 5" test="$i gt ($rating/20)" iter="$i--">
<img src="modules/ratings/xarimages/rate_none.gif" alt="star" />
</xar:for>
</xar:if>
</xar:if>
In this case I am using a 5-star method. if you would rather use a 10-star
method, change the 20s into 10s. in this case, my images are called
rate_full, rate_half, and rate_none, and are located in the ratings module
folder. you can also put them into your theme and call them from there.
--
- Ladyofdragons