Hi,
Right now you can see the Rating stars and the number of voted underneath the thumbnail.
What I want is to add the rating number.
So under the thumbnail you see => (2 votes) change into (2 votes, 9.3)
Thanks,
Edward
Open include/functions.inc.php and find
if (in_array('pic_rating', $must_have)) {
if (defined('THEME_HAS_RATING_GRAPHICS')) {
$prefix = $THEME_DIR;
} else {
$prefix = '';
}
//calculate required amount of stars in picinfo
$rating = round(($row['pic_rating'] / 2000) / (5 / $CONFIG['rating_stars_amount']));
$rating_images = '';
for ($i = 1; $i <= $CONFIG['rating_stars_amount']; $i++) {
if ($i <= $rating) {
$rating_images .= '<img src="' . $prefix . 'images/rate_full.png" alt="' . $rating . '"/>';
} else {
$rating_images .= '<img src="' . $prefix . 'images/rate_empty.png" alt="' . $rating . '"/>';
}
}
$caption .= '<span class="thumb_caption">' . $rating_images . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . '</span>';
}
The last line is the important one to add custom content. We need to know how you calculate the displayed rating number. What's the best possible rating? I assume 10?
Yes 10
How many decimal places have to be displayed at maximum?
Just add
$caption = substr($caption, 0, -8).", ".round(($row['pic_rating'] / 1000), 1).")</span>";
below
$caption .= '<span class="thumb_caption">' . $rating_images . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . '</span>';
to display 1 decimal place.
1 decimal
Seems that you missed the edit in my previous posting.
Changed some things:
$caption .= '<span class="thumb_caption">' . '</br>' . '<center>'. $rating_images . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . ", rating ".round(($row['pic_rating'] / 1000), 1).")</span>" . '</center>';
This results into:
(2 votes), rating 7.3)
How do I get ride of the ")" after the votes ??
Quote from: altenae on December 02, 2011, 04:53:59 PM
How do I get ride of the ")" after the votes ??
With the above mentioned code.
With the above code it looks like this:
(2 votes)<, 8)
Please undo your modifications and just apply my code for a start. Then you'll see that it works as expected and then add your further customizations.
Yep you are right...
It works now..
Thank you Andre