Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[SOLVED] Show latest page of comments in
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

Unknown User
2019-09-08 11:56:25
I want to set the last page of comments when there are several pages of comments so users can continue discussion without having to go on the latest page.

Here's the example on the demonoid -> https://www.dnoid.to/files/details/7676/077675117/#comments
Unknown User
2019-09-08 13:36:36
not sure if this is what you want but it will show last comments first
in torrents-deatils
change

$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id $limit";


to this

$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.added DESC $limit";
Unknown User
2019-09-08 14:29:35
Ah not that, it will just swap the order of comment by DESC
2019-09-08 15:01:44
try just changing the DESC to ASC. Just a guess
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2019-09-08 15:11:28
"MicroMonkey, post: 67181, member: 311":

try just changing the DESC to ASC. Just a guess

Changing that will just make it as default. The pagination pager should open last page when open a torrent details like on demonoid
Unknown User
2019-09-08 15:21:52
you will need to edit backend functions

look for

function pager($rpp, $count, $href, $opts = array()) {

and look into this part of the code

   $start = $i * $rpp + 1;

           $end = $start + $rpp - 1;


i dont use comments on my site as my site isnt a tracker more of an torrent indexer
if you do mess about with this bare in mind it will change all pagenation ie forums etc would be better to copy the function and change it to what you need
Unknown User
2019-09-08 15:28:24
Thanks [USER=1398]@serph[/USER]

That worked great.
Unknown User
2019-09-08 15:33:38
post you're code incase other people might like it (y)?
Unknown User
2019-09-08 17:01:51
I did a different approach to this, you just gave me an idea how to access it :P
$pagedefault = floor(($count - 1) / $rpp);

function pager2($rpp, $count, $href, $opts = array()) {
   $pages = ceil($count / $rpp);
   if (!$opts["lastpagedefault"])
       $pagedefault = floor(($count - 1) / $rpp);

   if (isset($_GET["page"])) {
       $page = (int) $_GET["page"];
       if ($page < 0)
           $page = $pagedefault;
   }
   else
       $page = $pagedefault;
   $pager = "";
   $mp = $pages - 1;
   $as = "<b>&lt;&lt;&nbsp;".T_("PREVIOUS")."</b>";
   if ($page >= 1) {
       $pager .= "<a href=\"{$href}page=" . ($page - 1) . "\">";
       $pager .= $as;
       $pager .= "</a>";
   }
   else
       $pager .= $as;
   $pager .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
   $as = "<b>".T_("NEXT")."&nbsp;&gt;&gt;</b>";
   if ($page < $mp && $mp >= 0) {
       $pager .= "<a href=\"{$href}page=" . ($page + 1) . "\">";
       $pager .= $as;
       $pager .= "</a>";
   }
   else
       $pager .= $as;
   if ($count) {
       $pagerarr = array();
       $dotted = 0;
       $dotspace = 3;
       $dotend = $pages - $dotspace;
       $curdotend = $page - $dotspace;
       $curdotstart = $page + $dotspace;
       for ($i = 0; $i < $pages; $i++) {
           if (($i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) {
               if (!$dotted)
                   $pagerarr[] = "...";
               $dotted = 1;
               continue;
           }
           $dotted = 0;
           $start = $i * $rpp + 1;
           $end = $start + $rpp - 1;
           if ($end > $count)
               $end = $count;
           $text = "$start&nbsp;-&nbsp;$end";
           if ($i != $page)
               $pagerarr[] = "<a href=\"{$href}page=$i\"><b>$text</b></a>";
           else
               $pagerarr[] = "<b>$text</b>";
       }
       $pagerstr = join(" | ", $pagerarr);
       $pagertop = "<p align=\"center\">$pager<br />$pagerstr</p>\n";
       $pagerbottom = "<p align=\"center\">$pagerstr<br />$pager</p>\n";
   }
   else {
       $pagertop = "<p align=\"center\">$pager</p>\n";
       $pagerbottom = $pagertop;
   }
   $start = $page * $rpp;
   return array($pagertop, $pagerbottom, "LIMIT $start,$rpp");
}
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728