Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/02/2008, 05:22
p2pdownloading
Invitado
 
Mensajes: n/a
Puntos:
Re: paginacion con php fmdeluxe

y este es el de las categorias

Código PHP:
<?php
$tt_sql 
= mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'cat_table_top'");
$tt=mysql_fetch_array($tt_sql);
$table_top=$tt["template"];

    if(isset(
$_POST['sub']))
{
    
$breadcrumb = ":: <a href='index.php'>{*HOME*}</a> ::";
    
$table_top = str_replace("{php=breadcrumb}", $breadcrumb, $table_top);
    
$table_top = lang_convert($table_top);

    
$cat_pass = sha1(md5($_POST['cat_pass']));
    
$cID = $_POST['cid'];
    
    
$sql = mysql_query("SELECT cPwd FROM ".DB_PREFIX."categories WHERE cID = '".$cID."'");    
    
$r=mysql_fetch_array($sql);
    
$cPwd=stripslashes($r["cPwd"]);
    
    if(
$cat_pass === $cPwd)
{
    
$_SESSION['cat_'.$cID] = $cPwd;

    
$cat_page = "{*LOCKED_GRANT*}<meta http-equiv='Refresh' content='2;url=index.php?action=category&id=".$cID."'>";
} else {
    
$cat_page = "{*LOCKED_DENIED*}<meta http-equiv='Refresh' content='2;url=index.php'>";
}

} else {

    if(
$_GET['id'] != '')
{
    
$cID = mysql_real_escape_string(stripslashes($_GET['id']));
} else {
    
$cID = '0';
}

    
$check_sql = mysql_query("SELECT * FROM ".DB_PREFIX."categories WHERE cID = '".$cID."'");
    if(
$cID > '0')
{
    if(
mysql_num_rows($check_sql) == '0')
{
    echo 
"<meta http-equiv='Refresh' content='0;url=index.php?action=failed&fail=cInvalid'>";
    exit;
} else {
    
$cs=mysql_fetch_array($check_sql);
    
$cPwd=$cs["cPwd"];

    if(
$cPwd != '')
{
    if(
$_SESSION['cat_'.$cID] != $cPwd)
{
    echo 
"<meta http-equiv='Refresh' content='0;url=index.php?action=failed&locked=".$cID."'>";
    exit;
}}}
}

    
$breadcrumb = breadcrumb($cID, '1', '');
    
$table_top = str_replace("{php=breadcrumb}", $breadcrumb, $table_top);
    
$table_top = lang_convert($table_top);
    
    
$tr_sql = mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'cat_list'");
    
$tr=mysql_fetch_array($tr_sql);
    
$tableRow=$tr["template"];

    
$sql = mysql_query("SELECT * FROM ".DB_PREFIX."categories WHERE cParent = '".$cID."' ORDER BY cOrder ASC");

    if(
mysql_num_rows($sql) == '0')
{
    
$cat_page = "{*NO_CATS*}";

} else { 

    while(
$r=mysql_fetch_array($sql))
{
    
$cat_ID=$r["cID"];
    
$cName=$r["cName"];
    
$cDesc=$r["cDesc"];
    
$cPwd=$r["cPwd"];
    
$scCount=$r["scCount"];
    
$dCount=$r["dCount"];

    if(
$scCount != '0')
{
    
$sc_sql = mysql_query("SELECT cID, scCount, dCount FROM ".DB_PREFIX."categories WHERE cParent = '".$cat_ID."'");
    while(
$sc=mysql_fetch_array($sc_sql))
{
    
$scID=$sc["cID"];
    
$scC=$sc["scCount"];
    
$dc=$sc["dCount"];
    
    
$dCount += $dc;

    if(
$scC != '0')
{
    
$dCount += downCount($scID);
}}
}    

    
$cat_row = str_replace("{php=cat_id}", $cat_ID, $tableRow);
    
$cat_row = str_replace("{php=cat_name}", $cName, $cat_row);
    
$cat_row = str_replace("{php=cat_desc}", $cDesc, $cat_row);
    
$cat_row = str_replace("{php=sub_cats}", $scCount, $cat_row);
    
$cat_row = str_replace("{php=total_files}", $dCount, $cat_row);

    if(
$cPwd != '')
{
    
$locked = "<b>{*LOCKED*}:</b>&nbsp;";
    
$cat_row = str_replace("{php=cat_pwd}", $locked, $cat_row);
} else {
    
$cat_row = str_replace("{php=cat_pwd}", "", $cat_row);
}

    
$cat_page .= $cat_row;
}
    

    if(
$cID == '0')
{
    if(
$allFiles == '1')
{
    
$tr_sql = mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'cat_all_files'");
    
$tr=mysql_fetch_array($tr_sql);
    
$all_row=$tr["template"];

    
$all_scCount = '0';
    
$all_dCount = '0';

    
$a_sql = mysql_query("SELECT scCount, dCount FROM ".DB_PREFIX."categories ORDER BY cID ASC");
    while(
$ar=mysql_fetch_array($a_sql))
{
    
$all_dCount += $ar["dCount"];
}
    
$all_row = str_replace("{php=sub_cats}", $all_scCount, $all_row);
    
$all_row = str_replace("{php=total_files}", $all_dCount, $all_row);

    
$cat_page .= $all_row;
}}
}
}
    
$cat_page = lang_convert($cat_page);




$tb_sql = mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'cat_table_bottom'");
$tb=mysql_fetch_array($tb_sql);
$table_bottom=$tb["template"];

    if(
$_GET['id'] != '')
{
    
$scribeID = $_GET['id'];
} else {
    
$scribeID = '0';
}
    
$table_bottom = str_replace("{php=time_zone}", $timeZone, $table_bottom);
    
$table_bottom = str_replace("{php=scribe_id}", $scribeID, $table_bottom);
    
$table_bottom = str_replace("{php=quick_jump_menu}", $quickjump, $table_bottom);
    
$table_bottom = lang_convert($table_bottom);


// Display the category table
    
echo $table_top;
    echo 
$cat_page;
    echo 
$table_bottom;



// Start to display downloads if it isn't the main category! 

    
if($cID > '0')
{
    echo 
"<br />";

$tt_sql = mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'down_table_top'");
$tt=mysql_fetch_array($tt_sql);
$table_top=$tt["template"];

    
$breadcrumb = breadcrumb($cID, '0', '');
    
$table_top = str_replace("{php=breadcrumb}", $breadcrumb, $table_top);
    
$table_top = lang_convert($table_top);

    
$tr_sql = mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'down_list'");
    
$tr=mysql_fetch_array($tr_sql);
    
$tableRow=$tr["template"];

    
$sql = mysql_query("SELECT noFiles FROM ".DB_PREFIX."categories WHERE cID = '".$cID."'");    
    
$r=mysql_fetch_array($sql);
    
$limit=$r["noFiles"];

    
$sql = mysql_query("SELECT dID, dName, dDesc, author, dateAdd, count FROM ".DB_PREFIX."downloads WHERE cID = '".$cID."' && sticky = '1' && approved = '1' ORDER BY dID DESC");
    
    
$noSticky = '0';
    if(
mysql_num_rows($sql) > '0')
{
    
$noSticky = mysql_num_rows($sql);
    
$limit -= $noSticky;

    while(
$r=mysql_fetch_array($sql))
{
    
$dID=stripslashes($r["dID"]);
    
$dName=stripslashes($r["dName"]);
    
$dDesc=substr(stripslashes($r["dDesc"]), 0, 35);
    
$author=stripslashes($r["author"]);
    
$dateAdd=stripslashes($r["dateAdd"]);
    
$count=stripslashes($r["count"]);
    
$rating=rating($dID, 1);
    
    
$down_row = str_replace("{php=down_id}", $dID, $tableRow);
    
$down_row = str_replace("{php=down_name}", $dName, $down_row);
    
$down_row = str_replace("{php=sticky}", "{*PINNED*}", $down_row);
    
$down_row = str_replace("{php=down_desc}", $dDesc, $down_row);
    
$down_row = str_replace("{php=author}", $author, $down_row);
    
$down_row = str_replace("{php=date_added}", $dateAdd, $down_row);
    
$down_row = str_replace("{php=down_count}", $count, $down_row);
    
$down_row = str_replace("{php=rating}", $rating, $down_row);
    

    
$down_page .= $down_row;
}}

    
$query_count    = "SELECT * FROM ".DB_PREFIX."downloads WHERE cID = '".$cID."' && sticky = '0' && approved = '1'";    
        
$result_count   = mysql_query($query_count);    
        
$totalrows      = mysql_num_rows($result_count);
        
    if(
is_numeric($_GET['page']))
{
    
$page = $_GET['page'];
} else {
        
$page = '1';
}       

    
$numofpages = $totalrows / $limit;
       
$limitvalue = $page * $limit - ($limit);

    if(isset(
$_POST['sort_sub']))
{
    
$sort = htmlentities($_POST['sort'], ENT_QUOTES);
    
$order = htmlentities($_POST['order'], ENT_QUOTES);
} else {
    
$sort = "dID";
    
$order = "DESC";
}

        
$query  = "SELECT dID, dName, dDesc, author, dateAdd, count FROM ".DB_PREFIX."downloads WHERE cID = '".$cID."' && sticky = '0' && approved = '1' ORDER BY ".$sort." ".$order." LIMIT $limitvalue, $limit";        
       
$result = mysql_query($query);

    if(
$noSticky == '0' && $totalrows == '0')
{
    
$down_page = "{*NO_DOWNS*}";

} else {

    while(
$r=mysql_fetch_array($result))
{
    
$dID=stripslashes($r["dID"]);
    
$dName=stripslashes($r["dName"]);
    
$dDesc=substr(stripslashes($r["dDesc"]), 0, 35);
    
$author=stripslashes($r["author"]);
    
$dateAdd=stripslashes($r["dateAdd"]);
    
$count=stripslashes($r["count"]);
    
$rating=rating($dID, 1);
    
    
$down_row = str_replace("{php=down_id}", $dID, $tableRow);
    
$down_row = str_replace("{php=down_name}", $dName, $down_row);
    
$down_row = str_replace("{php=sticky}", "", $down_row);
    
$down_row = str_replace("{php=down_desc}", $dDesc, $down_row);
    
$down_row = str_replace("{php=author}", $author, $down_row);
    
$down_row = str_replace("{php=date_added}", $dateAdd, $down_row);
    
$down_row = str_replace("{php=down_count}", $count, $down_row);
    
$down_row = str_replace("{php=rating}", $rating, $down_row);
    

    
$down_page .= $down_row;
}

    
$page_nav = page_nav("action=category&id=".$cID);

    
$pagination = "<table cellspacing='2' cellpadding='2'>
    <tr>
    "
.$page_nav."    
    </tr>
    </table>"
;
}

    
$down_page = lang_convert($down_page);

$tb_sql = mysql_query("SELECT * FROM ".DB_PREFIX."templates WHERE tID = '".$theme."' && tmName = 'down_table_bottom'");
$tb=mysql_fetch_array($tb_sql);
$table_bottom=$tb["template"];

    
$address = "index.php?action=category&id=".$cID;

    
$table_bottom = str_replace("{php=cat_id}", $cID, $table_bottom);
    
$table_bottom = str_replace("{php=pagination}", $pagination, $table_bottom);
    
$table_bottom = str_replace("{php=address}", $address, $table_bottom);
    
$table_bottom = lang_convert($table_bottom);



// Display the downloads table
    
echo $table_top;
    echo 
$down_page;
    echo 
$table_bottom;
}


?>
que parte del codigo tengo que editar para que las categorias se queden fijas y en cambio se mueva el contenido del centro de la pag?

saludos