MyBB Community Forums

Full Version: Star Rating
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've created a new page (custom) with some guides and I want to make the users able to rate the guides with the Star Rating.

Here is the page code:
<html>
<head>
<title>Warbon Golden Guides - Ultimate Strength</title>
<link type="text/css" rel="stylesheet" href="http://warbon.0fees.net/forums/cache/themes/theme3/star_ratings.css" />
{$headerinclude}
</head>
<body>
{$header}
<div id="tabmenu_1"> <table border="0" cellspacing="1" cellpadding="6" class="tborder"><thead>
<tr>
<td class="thead" colspan="4">
<div class="expcolimage"><img src="images/dark//collapse.gif" id="cat_1_img" class="expander" alt="[-]" title="[-]" /></div>
<div><strong><a href="forum-1.html">Warbon Golden Guides</a></strong><br /><div class="smalltext"></div></div>
</td>
</tr>
</thead>
<tbody style="" id="cat_1_e">
<tr>
<td class="tcat" colspan="2"><span class="smalltext"><strong>Golden Guide Name</strong></span></td>
<td class="tcat" width="200" align="center"><span class="smalltext"><strong>Author</strong></span></td>
<td class="tcat" width="85" align="center" style="white-space: nowrap"><span class="smalltext"><strong>Star Rating</strong></span>
<script type="text/javascript" src="jscripts/rating.js?ver=1400"></script>
<script type="text/javascript">
<!--
lang.stars = new Array();
lang.stars[1] = "1 star out of 5";
lang.stars[2] = "2 stars out of 5";
lang.stars[3] = "3 stars out of 5";
lang.stars[4] = "4 stars out of 5";
lang.stars[5] = "5 stars out of 5";
// -->
</script>
</td>
</tr>
<tr>
<td class="trow3" align="center" valign="middle" width="1"><img src="images/dark//off.png" alt="Forum Contains No New Posts" title="Forum Contains No New Posts" class="ajax_mark_read" id="mark_read_2" /></td>
<td class="trow4" valign="middle">
<strong><a href="strength.php">Ultimate Strength</a></strong><div class="smalltext"></div>
</td>
<td class="trow4" valign="middle" align="left" style="white-space: nowrap">
<span class="smalltext">
<div align="center" valign="middle" style="font-size: 15px;"><a href="user-1.html">admin</a></div></span>
<div align="right"><span class="smalltext">
<font color="#404040">© Warbon</font></span>
<td align="center" class="trow1" id="rating_table_{$thread['tid']}">
		<ul class="star_rating{$not_rated}" id="rating_thread_{$thread['tid']}">
			<li style="width: {$thread['width']}%" class="current_rating" id="current_rating_{$thread['tid']}">{$ratingvotesav}</li>
		</ul>
		<script type="text/javascript">
		<!--
			Rating.build_forumdisplay({$thread['tid']}, { width: '{$thread['width']}', extra_class: '{$not_rated}', current_average: '{$ratingvotesav}' });
		// -->
		</script>
	</td>
</tr>
</tbody>
</table>
</div>
{$footer}
</body>
</html>
<td class="trow3" valign="middle" align="center"></td>

I have already added the star_ratings.css:
<link type="text/css" rel="stylesheet" href="http://warbon.0fees.net/forums/cache/themes/theme3/star_ratings.css" />

And the script to the <td>:
<script type="text/javascript" src="jscripts/rating.js?ver=1400"></script>
<script type="text/javascript">
<!--
lang.stars = new Array();
lang.stars[1] = "1 star out of 5";
lang.stars[2] = "2 stars out of 5";
lang.stars[3] = "3 stars out of 5";
lang.stars[4] = "4 stars out of 5";
lang.stars[5] = "5 stars out of 5";
// -->
</script>

This is the code to add the stars:
<td align="center" class="trow1" id="rating_table_{$thread['tid']}">
		<ul class="star_rating{$not_rated}" id="rating_thread_{$thread['tid']}">
			<li style="width: {$thread['width']}%" class="current_rating" id="current_rating_{$thread['tid']}">{$ratingvotesav}</li>
		</ul>
		<script type="text/javascript">
		<!--
			Rating.build_forumdisplay({$thread['tid']}, { width: '{$thread['width']}', extra_class: '{$not_rated}', current_average: '{$ratingvotesav}' });
		// -->
		</script>
	</td>


Is possible to use this code without the {$thread['tid']}....
How do I add the MyBB rating system to this page?


Thank you.
Unless your guides are associated to a particular thread, I don't think it will be easy to do this.
Mhmm... They aren't.
Argh...
Any other suggestion to add star rating to my custom pages?