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:
![[Image: what_i_have.png]](https://camo.mybb.com/12979bbb96ac96dd2572ff448290a720e8e60232/687474703a2f2f646c2e64726f70626f782e636f6d2f752f393735333336372f6d7962625f726174696e672f776861745f695f686176652e706e67)
What I want:
![[Image: what_i_want.png]](https://camo.mybb.com/4e49980724afffcad41baab4bd86b8c88468369d/687474703a2f2f646c2e64726f70626f782e636f6d2f752f393735333336372f6d7962625f726174696e672f776861745f695f77616e742e706e67)
Generated code (exactly the same on both pages):
![[Image: generated_code.png]](https://camo.mybb.com/d2f2ae31a40f256cc5d26e297e45bcc059178505/687474703a2f2f646c2e64726f70626f782e636f6d2f752f393735333336372f6d7962625f726174696e672f67656e6572617465645f636f64652e706e67)
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