Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > BT.Manager (phpMyBitTorrent)
Reply
Thread Tools
  #1  
Old 2nd July 2011, 12:53
it53lv's Avatar
it53lv it53lv is offline
Senior Member
 
Join Date: Feb 2011
Latvia
Posts: 134
Default help needed on imperialbt torrents.php
so i cooked up a new look for pagination > screen attached
so i need someone to get top pagination to work
since query is between top and bottom pagination code
top one is not working
code is all right i think i haven't messed anything up
only "Jump to" is still just a placeholder haven't wrote jquery for that jet

so here is my torrents.php
Code:
<?php 
if (defined('IN_PMBT'))die ("You can't include this file"); 
define("IN_PMBT",true); 
include("header.php"); 
require('actb.php');
echo "<div class=\"topic_controls\">
<ul class=\"pagination bottom left\">
<li class=\"total pagejump clickable\">Jump to
<img src=\"$siteurl/themes/$theme/pics/imperial/dropdown.png\" alt=\"+\" />
</li>".$prev."".(($pages > 1) ? $pager : "")."".$next."</ul>
<ul class=\"topic_buttons\">
<li><a href=\"upload.php?op=link\" title=\"\">
<img src=\"$siteurl/themes/$theme/pics/imperial/topic_watch.png\" alt=\"\" />Upload ed2k link</a>
</li>
<li><a href=\"upload.php?op=torrent\" title=\"\">
<img src=\"$siteurl/themes/$theme/pics/imperial/page_white_add.png\" alt=\"\" />Upload torrent</a>
</li>
</ul>
</div>";
echo "
<div id=\"forum_filter\" class=\"filter_bar rounded\">
<span id=\"show_filters\" class=\"clickable\">Click here to toggle CATEGORIES</span>
</div>
<div class=\"categories_form\"><div class=\"border\"><div id=\"tbg\">
<table class=\"bottom\">
<tr>";
 $i = 0; 
foreach (catlist() as $c) { 
$i++; 
echo "<td class=\"bottom\" style=\"padding-bottom: 2px; padding-left: 7px;\" align=\"left\"><input value=\"1\" type=\"checkbox\"><a href=\"torrents.php?cat=".$c["id"]."\">".$c["name"]."</a></td>"; 
if ($i == 6) { 
echo "</tr><tr>"; 
$i = 0; 
 } 
}
echo "</tr></table>";
echo"</div></div></div><div id=\"myborder\"></div>"; 
#OBT: Add joe's table-head sorting function: 
$sort =  (isset($_GET["sort"])) ? $_GET["sort"] : ''; 
$type =  (isset($_GET["type"])) ? $_GET["type"] : ''; 
$orderby = " ORDER BY ".$db_prefix."_torrents.evidence DESC, ";// 
if ($sort == 1) $orderby = " ORDER BY ".$db_prefix."_torrents.name $type,  ";// 
 
if ($sort == 2){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.numfiles $type,  ";// 
} 
if ($sort == 3){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.comments $type,  ";// 
} 
if ($sort == 4){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.category $type,  ";// 
} 
if ($sort == 5){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.size $type,  "; 
} 
if ($sort == 6){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.times_completed $type,  "; 
} 
if ($sort == 7){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.seeders $type,  ";// 
} 
if ($sort == 8){ 
$orderby = " ORDER BY ".$db_prefix."_torrents.leechers $type,  ";// 
} 
 
if ($onlysearch) { 
        OpenTable(_btnosearchttl); 
        echo _btnosearch; 
        CloseTable(); 
} else { 
        if (!isset($page) OR !is_numeric($page) OR $page < 1) $page = 1; 
        if (!isset($cat)) $cat = ""; 
        if (intval($cat) > 0) $catwhere = " AND ".$db_prefix."_torrents.category = ".intval($cat); 
        else $catwhere = ""; 
        $passwhere = " AND ".$db_prefix."_torrents.password IS NULL "; 
        $viswhere = "visible = 'yes' AND banned = 'no'"; 
        if ($user->moderator) $viswhere = "1"; 
        if ($user->premium) $passwhere = ""; 
 
        $from = ($page - 1) * $torrent_per_page; 
 
        $totsql = "SELECT COUNT(*) as tot FROM ".$db_prefix."_torrents WHERE ".$viswhere.$catwhere.$passwhere.";"; 
        $sql = "SELECT ".$db_prefix."_torrents.*, IF(".$db_prefix."_torrents.numratings < '".$minvotes."', NULL, ROUND(".$db_prefix."_torrents.ratingsum / ".$db_prefix."_torrents.numratings, 1)) AS rating, ".$db_prefix."_categories.name AS cat_name, ".$db_prefix."_categories.image AS cat_pic, U.username, IF(U.name IS NULL, U.username, U.name) as user_name, U.level as user_level FROM ".$db_prefix."_torrents LEFT JOIN ".$db_prefix."_categories ON category = ".$db_prefix."_categories.id LEFT JOIN ".$db_prefix."_users U ON ".$db_prefix."_torrents.owner = U.id WHERE ".$viswhere.$catwhere.$passwhere.$orderby.$db_prefix."_torrents.added DESC LIMIT ".$from.",".$torrent_per_page.";"; 
 
        $res = $db->sql_query($sql) or btsqlerror($sql); 
        $totres = $db->sql_query($totsql); 
 
if (isset($sort))$sort1= "&sort=".$sort."&type=".$type; 
else 
$sort1=""; 
if (isset($sort))$sort2= "?sort=".$sort."&type=".$type; 
else 
$sort2=""; 
        list ($tot) = $db->sql_fetchrow($totres); 
        $db->sql_freeresult($totres); 
        if ($db->sql_numrows($res) > 0) { 
                $pages = ceil($tot / $torrent_per_page); 
 
if($page < $pages & $cat) { 
$next = "<a href=\"torrents.php?page=".($page+1)."&cat=".$cat."\"><li class=\"next\">&gt;</li></a>"; 
} elseif($page < $pages ) { 
$next = "<a href=\"torrents.php?page=".($page+1).$sort1."\"><li class=\"active\">&gt;</li></a>"; 
}else{ 
$next = "<li class=\"next\">&gt;</li>"; 
} 
if($page > 1 & $cat) { 
$prev = "<a href=\"torrents.php?page=".($page-1)."&cat=".$cat."\"><li class=\"prev\">&lt;</li></a>"; } elseif($page > 1) { 
$prev = "<a href=\"torrents.php?page=".($page-1).$sort1."\"><li class=\"active\">&lt;</li></a>"; 
}else{ 
$prev = "<li class=\"prev\">&lt;</li>"; 
} 
if($cat){ 
$pager = "<a href=\"torrents.php?cat=".$cat."\">".(($page == 1) ? "<li class=\"active\">1</li>" : "<li class=\"inside2\">1</li>")."</a>"; 
if (($page - 15) > 1) $pager .= "..."; 
for ($i = max(2,$page - 15); $i < min($pages, $page + 15); $i++) { 
$pager .= "<a href=\"torrents.php?page=".$i."&cat=".$cat."\">".(($i == $page) ? "<li class=\"active\">".$i."</li>" : "<li class=\"inside2\">".$i."</li>")."</a>"; 
} 
if (($page + 15) < $pages) $pager .= "..."; 
$pager .= "<a href=\"torrents.php?page=".$pages."&cat=".$cat."\">".(($page == $pages) ? "<li class=\"active\">".$pages."</li>" : "<li class=\"inside2\">".$pages."</li>")."</a>";
torrenttable($res); 
}else { 
$pager = "<a href=\"torrents.php".$sort2."\">".(($page == 1) ? "<li class=\"active\">1</li>" : "<li class=\"inside2\">1</li>")."</a>"; 
if (($page - 15) > 1) $pager .= "..."; 
for ($i = max(2,$page - 15); $i < min($pages, $page + 15); $i++) { 
$pager .= "<a href=\"torrents.php?page=".$i.$sort1."\">".(($i == $page) ? "<li class=\"active\">".$i."</li>" : "<li class=\"inside2\">".$i."</li>")."</a>"; 
} 
if (($page + 15) < $pages) $pager .= "..."; 
$pager .= "<a href=\"torrents.php?page=".$pages.$sort1."\">".(($page == $pages) ? "<li class=\"active\">".$pages."</li>" : "<li class=\"inside2\">".$pages."</li>")."</a>"; 
torrenttable($res); 
}
echo "<div class=\"topic_controls\">
<ul class=\"pagination bottom left\">
<li class=\"total pagejump clickable\">Jump to
<img src=\"$siteurl/themes/$theme/pics/imperial/dropdown.png\" alt=\"+\" />
</li>".$prev."".(($pages > 1) ? $pager : "")."".$next."</ul></div>"; 
} 
} 
include("footer.php"); 
?>
Attached Thumbnails
pagination.png  
Reply With Quote
  #2  
Old 2nd July 2011, 14:57
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
because you are trying to use
PHP Code:
</li>".$prev."".(($pages > 1) ? $pager : "")."".$next."</ul
on line 10 before it is defind
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #3  
Old 2nd July 2011, 15:10
it53lv's Avatar
it53lv it53lv is offline
Senior Member
 
Join Date: Feb 2011
Latvia
Posts: 134
Default
explain why this code works for bottom and not top ?
because i don't see any problem with it since all other li tags are coded in to next and prev functions
Reply With Quote
  #4  
Old 2nd July 2011, 15:21
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
I did explain in my post you are trying to use information that has not been defined.
on the bottom of the page it is defined on the top it is not.
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #5  
Old 2nd July 2011, 15:26
it53lv's Avatar
it53lv it53lv is offline
Senior Member
 
Join Date: Feb 2011
Latvia
Posts: 134
Default
i know that but hove can i move this definition ?
Reply With Quote
  #6  
Old 2nd July 2011, 16:11
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
PHP Code:
<?php 
if (defined('IN_PMBT'))die ("You can't include this file"); 
define("IN_PMBT",true); 
include(
"header.php"); 
require(
'actb.php');
echo 
"
<div id=\"forum_filter\" class=\"filter_bar rounded\">
<span id=\"show_filters\" class=\"clickable\">Click here to toggle CATEGORIES</span>
</div>
<div class=\"categories_form\"><div class=\"border\"><div id=\"tbg\">
<table class=\"bottom\">
<tr>"
;
 
$i 0
foreach (
catlist() as $c) { 
$i++; 
echo 
"<td class=\"bottom\" style=\"padding-bottom: 2px; padding-left: 7px;\" align=\"left\"><input value=\"1\" type=\"checkbox\"><a href=\"torrents.php?cat=".$c["id"]."\">".$c["name"]."</a></td>"
if (
$i == 6) { 
echo 
"</tr><tr>"
$i 0
 } 
}
echo 
"</tr></table>";
echo
"</div></div></div><div id=\"myborder\"></div>"
#OBT: Add joe's table-head sorting function: 
$sort =  (isset($_GET["sort"])) ? $_GET["sort"] : ''
$type =  (isset($_GET["type"])) ? $_GET["type"] : ''
$orderby " ORDER BY ".$db_prefix."_torrents.evidence DESC, ";// 
if ($sort == 1$orderby " ORDER BY ".$db_prefix."_torrents.name $type,  ";// 
 
if ($sort == 2){ 
$orderby " ORDER BY ".$db_prefix."_torrents.numfiles $type,  ";// 

if (
$sort == 3){ 
$orderby " ORDER BY ".$db_prefix."_torrents.comments $type,  ";// 

if (
$sort == 4){ 
$orderby " ORDER BY ".$db_prefix."_torrents.category $type,  ";// 

if (
$sort == 5){ 
$orderby " ORDER BY ".$db_prefix."_torrents.size $type,  "

if (
$sort == 6){ 
$orderby " ORDER BY ".$db_prefix."_torrents.times_completed $type,  "

if (
$sort == 7){ 
$orderby " ORDER BY ".$db_prefix."_torrents.seeders $type,  ";// 

if (
$sort == 8){ 
$orderby " ORDER BY ".$db_prefix."_torrents.leechers $type,  ";// 

 
if (
$onlysearch) { 
        
OpenTable(_btnosearchttl); 
        echo 
_btnosearch
        
CloseTable(); 
} else { 
        if (!isset(
$page) OR !is_numeric($page) OR $page 1$page 1
        if (!isset(
$cat)) $cat ""
        if (
intval($cat) > 0$catwhere " AND ".$db_prefix."_torrents.category = ".intval($cat); 
        else 
$catwhere ""
        
$passwhere " AND ".$db_prefix."_torrents.password IS NULL "
        
$viswhere "visible = 'yes' AND banned = 'no'"
        if (
$user->moderator$viswhere "1"
        if (
$user->premium$passwhere ""
 
        
$from = ($page 1) * $torrent_per_page
 
        
$totsql "SELECT COUNT(*) as tot FROM ".$db_prefix."_torrents WHERE ".$viswhere.$catwhere.$passwhere.";"
        
$sql "SELECT ".$db_prefix."_torrents.*, IF(".$db_prefix."_torrents.numratings < '".$minvotes."', NULL, ROUND(".$db_prefix."_torrents.ratingsum / ".$db_prefix."_torrents.numratings, 1)) AS rating, ".$db_prefix."_categories.name AS cat_name, ".$db_prefix."_categories.image AS cat_pic, U.username, IF(U.name IS NULL, U.username, U.name) as user_name, U.level as user_level FROM ".$db_prefix."_torrents LEFT JOIN ".$db_prefix."_categories ON category = ".$db_prefix."_categories.id LEFT JOIN ".$db_prefix."_users U ON ".$db_prefix."_torrents.owner = U.id WHERE ".$viswhere.$catwhere.$passwhere.$orderby.$db_prefix."_torrents.added DESC LIMIT ".$from.",".$torrent_per_page.";"
 
        
$res $db->sql_query($sql) or btsqlerror($sql); 
        
$totres $db->sql_query($totsql); 
 
if (isset(
$sort))$sort1"&sort=".$sort."&type=".$type
else 
$sort1=""
if (isset(
$sort))$sort2"?sort=".$sort."&type=".$type
else 
$sort2=""
        list (
$tot) = $db->sql_fetchrow($totres); 
        
$db->sql_freeresult($totres); 
        if (
$db->sql_numrows($res) > 0) { 
                
$pages ceil($tot $torrent_per_page); 
 
if(
$page $pages $cat) { 
$next "<a href=\"torrents.php?page=".($page+1)."&cat=".$cat."\"><li class=\"next\">&gt;</li></a>"
} elseif(
$page $pages ) { 
$next "<a href=\"torrents.php?page=".($page+1).$sort1."\"><li class=\"active\">&gt;</li></a>"
}else{ 
$next "<li class=\"next\">&gt;</li>"

if(
$page $cat) { 
$prev "<a href=\"torrents.php?page=".($page-1)."&cat=".$cat."\"><li class=\"prev\">&lt;</li></a>"; } elseif($page 1) { 
$prev "<a href=\"torrents.php?page=".($page-1).$sort1."\"><li class=\"active\">&lt;</li></a>"
}else{ 
$prev "<li class=\"prev\">&lt;</li>"

if(
$cat){ 
$pager "<a href=\"torrents.php?cat=".$cat."\">".(($page == 1) ? "<li class=\"active\">1</li>" "<li class=\"inside2\">1</li>")."</a>"
if ((
$page 15) > 1$pager .= "..."
for (
$i max(2,$page 15); $i min($pages$page 15); $i++) { 
$pager .= "<a href=\"torrents.php?page=".$i."&cat=".$cat."\">".(($i == $page) ? "<li class=\"active\">".$i."</li>" "<li class=\"inside2\">".$i."</li>")."</a>"

if ((
$page 15) < $pages$pager .= "..."
$pager .= "<a href=\"torrents.php?page=".$pages."&cat=".$cat."\">".(($page == $pages) ? "<li class=\"active\">".$pages."</li>" "<li class=\"inside2\">".$pages."</li>")."</a>";
torrenttable($res); 
}else { 
$pager "<a href=\"torrents.php".$sort2."\">".(($page == 1) ? "<li class=\"active\">1</li>" "<li class=\"inside2\">1</li>")."</a>"
if ((
$page 15) > 1$pager .= "..."
for (
$i max(2,$page 15); $i min($pages$page 15); $i++) { 
$pager .= "<a href=\"torrents.php?page=".$i.$sort1."\">".(($i == $page) ? "<li class=\"active\">".$i."</li>" "<li class=\"inside2\">".$i."</li>")."</a>"

if ((
$page 15) < $pages$pager .= "..."
$pager .= "<a href=\"torrents.php?page=".$pages.$sort1."\">".(($page == $pages) ? "<li class=\"active\">".$pages."</li>" "<li class=\"inside2\">".$pages."</li>")."</a>"
echo 
"<div class=\"topic_controls\">
<ul class=\"pagination bottom left\">
<li class=\"total pagejump clickable\">Jump to
<img src=\"
$siteurl/themes/$theme/pics/imperial/dropdown.png\" alt=\"+\" />
</li>"
.$prev."".(($pages 1) ? $pager "")."".$next."</ul>
<ul class=\"topic_buttons\">
<li><a href=\"upload.php?op=link\" title=\"\">
<img src=\"
$siteurl/themes/$theme/pics/imperial/topic_watch.png\" alt=\"\" />Upload ed2k link</a>
</li>
<li><a href=\"upload.php?op=torrent\" title=\"\">
<img src=\"
$siteurl/themes/$theme/pics/imperial/page_white_add.png\" alt=\"\" />Upload torrent</a>
</li>
</ul>
</div>"
;
torrenttable($res); 
}
echo 
"<div class=\"topic_controls\">
<ul class=\"pagination bottom left\">
<li class=\"total pagejump clickable\">Jump to
<img src=\"
$siteurl/themes/$theme/pics/imperial/dropdown.png\" alt=\"+\" />
</li>"
.$prev."".(($pages 1) ? $pager "")."".$next."</ul></div>"


include(
"footer.php"); 
?>
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #7  
Old 2nd July 2011, 16:16
it53lv's Avatar
it53lv it53lv is offline
Senior Member
 
Join Date: Feb 2011
Latvia
Posts: 134
Default
thankyou
Reply With Quote
Reply

Tags
imperialbt , needed , torrentsphp


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 20:54. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.