sharpe1983 |
16th January 2016 10:46 |
ajax pager code help
im trying to recode this ajax pager mod so that pager reads 1 2 3 4 5 instead of the arrow images mybe have the left and right arrows but would like to see the page numbers thanks in advance
Code:
// = This counts the total torrents for pagination
$sql2 = SELECT `torrents`.`id`, `torrents`.`name` AS `torrentname`, `torrents`.`filename`,`torrents`.`request`, `torrents`.`nuked`,`torrents`.`nukereason`,`torrents`.`tags`,`torrents`.`description`,`torrents`.`category`, `torrents`.`size`, `torrents`.`added`, `torrents`.`type`, `torrents`.`numfiles`, `torrents`.`comments`, `torrents`.`views`, `torrents`.`hits`, `torrents`.`times_completed`, `torrents`.`leechers`, `torrents`.`seeders`, `torrents`.`owner`, `users`.`username`, `users`.`last_browse`,`users`.`privacy`, `users`.`id` AS `user_id`, `categories`.`name` FROM `torrents` LEFT JOIN `users` ON `users`.`id`=`torrents`.`owner` LEFT JOIN `categories` ON `categories`.`id`=`torrents`.`category` . $where . $ccase . ;
$gettotals = $this->query($sql2);
$totalt = $this->rows;
$maxpage = ceil($totalt/$perpage);
$npage = array();
// = This makes the pagination
if($page > 1){
$pagefirst = document.getElementById('page').value='1';;
$npage[] = ;
$pagel = document.getElementById('page').value='$maxpage';;
$lastpage = . $maxpage . ;
$pageback = $page-1;
$pageba = document.getElementById('page').value='$pageback';;
$npage[] = ;
if($page < $maxpage){
$pageforr = $page+1;
$pagefor = document.getElementById('page').value='$pageforr';;
$npage[] = Page $page ;
$pagelast = document.getElementById('page').value='$maxpage';;
$npage[] = ;
$pagel = document.getElementById('page').value='$maxpage';;
$lastpage = . $maxpage . ;
}
}
if($maxpage > 1){
if($page == 1){
$pageforr = $page+1;
$pagefor = document.getElementById('page').value='$pageforr';;
$npage[] = Page $page ;
$pagelast = document.getElementById('page').value='$maxpage';;
$npage[] = ;
}
}
$output .= ;
$torrents = number_format(get_row_count(torrents));
//$output .= Total Torrents found: $totalt;
//$output .= Refresh Table;
foreach($npage as $key=>$val) {
$output .= $val;
}
|