Hello, I'm looking for the piece of code to put in function.php so that the stars of the votes appear in the torrent.php page.
function ratingpic($num)
{
global $config;
$r = round($num * 2) / 2;
if ($r != $num) {
$n = $num - $r;
if ($n < .25) {
$n = 0;
} elseif ($n >= .25 && $n < .75) {
$n = .5;
}
$r += $n;
}
if ($r < 1 || $r > 5) {
return;
}
return "<img src=\"" . $config["SITEURL"] . "/images/rating/$r.png\" border=\"0\" alt=\"rating: $num/5\" title=\"rating: $num/5\" />";
}
function ratingpic($num)
{
global $CONFIG;
$r = round($num * 2) / 2;
if ($r != $num) {
$n = $num - $r;
if ($n < .25)
$n = 0;
elseif ($n >= .25 && $n < .75)
$n = .5;
$r += $n;
}
if ($r < 1 || $r > 5)
return;
return "<div class=\"stars-rating\" style=\"--rating: $num;padding-bottom:7px\" aria-label=\"Rating is $num / 5\"></div>";
}
"niki, post: 69594, member: 20338":
thanks for the help I just made the modification and the stars don't show in the torrent page on torrent.php:rolleyes:
$site_config["torrenttable_columns"]// category = Category Image/Name, name = Torrent Name, dl = Download Link, uploader, comments = # of comments, completed = times completed, size, seeders, leechers, health = seeder/leecher ratio, external, wait = Wait Time (if enabled), rating = Torrent Rating, added = Date Added, nfo = link to nfo (if exists)
$site_config["torrenttable_columns"] = "tube,category,cover,name,dl,uploader,comments,size,seeders,leechers,health,external";
// size, speed, added = Date Added, tracker, completed = times completed
$site_config["torrenttable_expand"] = "";
case 'rating':
if (!$row["rating"]) {
$rating = "--";
} else {
$rating = "<a title='$row[rating]/5'>" . ratingpic($row["rating"]) . "</a>";
}
//$rating = ratingpic($row["rating"]);
//$srating .= "$rpic (" . $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated this torrent";
print("<td class='ttable_col$x' align='center'>$rating</td>");
break;
} case 'rating':
if (!$row["rating"]) {
$rating = "--";
} else {
// $rating = "<a title='$row[rating]/5'>" . ratingpic($row["rating"]) . "</a>";
// $rating = ratingpic($row["rating"]);
// $rating .= "$rpic (" . $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated this torrent";
}
print("<td class='ttable_col$x' align='center'>$rating</td>");
break;
}
case 'rating':
if (!$row["rating"])
$rating = "--";
else
$rating = "<a title='$row[rating]/5'>".ratingpic($row["rating"])."</a>";
//$rating = ratingpic($row["rating"]);
//$srating .= "$rpic (" . $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated this torrent";
print("<td class='ttable_col$x' align='center'>$rating</td>");
break;
}
if ($x == 2)
$x--;
else
$x++;
No users online
Torrents
Members
Online