
03-30-2009, 04:42 PM
|
|
|
Join Date: May 2007
Posts: 172
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by HappyPike
I managed to show forum style rating stars on the category file listing page using template conditions. If anyone is interested, here is the code to use:
Code:
<!-- Star Rating -->
<if condition="$file['rating'] >= 9.5">
<span style="float:$stylevar[right]"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_5.gif" border="0" alt="Rating" /></span>
<else />
<if condition="$file['rating'] >= 8.5">
<span style="float:$stylevar[right]"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_4.gif" border="0" alt="Rating" /></span>
<else />
<if condition="$file['rating'] >= 7.5">
<span style="float:$stylevar[right]"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_3.gif" border="0" alt="Rating" /></span>
<else />
<if condition="$file['rating'] >= 6.5">
<span style="float:$stylevar[right]"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_2.gif" border="0" alt="Rating" /></span>
<else />
<if condition="($file['rating'] >= 5) AND ($file['rating'] < 6.5)">
<span style="float:$stylevar[right]"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_1.gif" border="0" alt="Rating" /></span>
</if>
</if>
</if>
</if>
</if>
<!-- Star Rating End -->
Just edit the downloads_cat_filebit template and put the above code right before the file name link
<a href="downloads.php?do=file&id={$file['id']}">{$file['name']}</a>.
You can also use the above code to put the rating stars in the file details page, replacing the A+ to F grades. The template to edit for this is downloads_file .
You can tweak the numbers in the codes to anything you want. Just remember the rating is between 5 and 10, and unrated files have 0 as default value.
|
thanks really useful
|