2011-05-14, 04:58 AM
Hello, I'm trying to display the rating stars on a thread on a different page than showthread.php but it wouldn't work. Even when using the correct generated code (the one that displays the rating stars on the showthread.php page) it still shows as a simple list (not starts like it should be).
I really don't understand why it's doing this. Can we only display them on showthread page? If yes, why?
Thank you for your time.
Here are some pictures:
What I have:
What I want:
Generated code (exactly the same on both pages):
And PHP code to generate the rating display (same as the one used on showthread.php):
Using $ratethread
I really don't understand why it's doing this. Can we only display them on showthread page? If yes, why?
Thank you for your time.
Here are some pictures:
What I have:
What I want:
Generated code (exactly the same on both pages):
And PHP code to generate the rating display (same as the one used on showthread.php):
$lang->load("ratethread");
if($thread['numratings'] <= 0)
{
$thread['width'] = 0;
$thread['averagerating'] = 0;
$thread['numratings'] = 0;
}
else
{
$thread['averagerating'] = floatval(round($thread['totalratings']/$thread['numratings'], 2));
$thread['width'] = intval(round($thread['averagerating']))*20;
$thread['numratings'] = intval($thread['numratings']);
}
$query = $db->simple_select("threadratings", "uid", "tid='$tid' AND uid='$uid'");
$rated = $db->fetch_field($query, 'uid');
$not_rated = '';
if(!$rated)
{
$not_rated = ' star_rating_notrated';
}
$ratingvotesav = $lang->sprintf($lang->rating_average, $thread['numratings'], $thread['averagerating']);
eval("\$ratethread = \"".$templates->get("showthread_ratethread")."\";");
Using $ratethread