Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/06/2003, 11:04
9andres
 
Fecha de Ingreso: junio-2001
Ubicación: Rosario
Mensajes: 1.434
Antigüedad: 22 años, 10 meses
Puntos: 2
Sonrisa Paginacion con Demasiadas Paginas

Que tal, amigos tengo un archivo que se le ah agregado una Paginacion, pero resulta que hay mucho contenido y hay como 200 Paginas, y me gustaria que fuera del tipo

<- [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 ] -> y cuando le das a la flechita para pasar a la otra pagina el numero de adelante desaparesca t el numero que sigue al 11 aparesca, y asi.... no se si me esplico, estube leyendo un articulo en guebmaster.com para hacer eso pero la verdad que no me sale, lo veo demasiado distinto

El Codigo que uso para la paginacion es el siguiente:

Código PHP:
<?php

if (!eregi("modules.php"$_SERVER['PHP_SELF'])) {
    die (
"Usted no puede tener acceso a este archivo directamente...");
}

$index 1;
require_once(
"mainfile.php");
$module_name basename(dirname(__FILE__));
include(
"functions.php");

function 
theindex($new_topic=0) {
#Page Numbers ver1.0, add $pagenum to global
    
global $dbi$storyhome$topicname$topicimage$topictext$datetime$user$cookie$nukeurl$prefix$multilingual$currentlang$articlecomm$sitename$pagenum;
    if (
$multilingual == 1) {
    
$querylang "AND (alanguage='$currentlang' OR alanguage='')";
    } else {
    
$querylang "";
    }
    include(
"header.php");
    
automated_news();
    if (isset(
$cookie[3])) {
    
$storynum $cookie[3];
    } else {
    
$storynum $storyhome;
    }
    if (
$new_topic == 0) {
    
$qdb "WHERE (ihome='0' OR catid='0')";
    
$home_msg "";
    } else {
    
$qdb "WHERE topic='$new_topic'";
    
$res sql_query("select topictext from ".$prefix."_topics where topicid='$new_topic'"$dbi);
    list(
$topic_title) = sql_fetch_row($res$dbi);
    
OpenTable();
    if (
sql_num_rows($res$dbi) == 0) {
        echo 
"<center><font class=\"title\">$sitename</font><br><br>"._NOINFO4TOPIC."<br><br>[ <a href=\"index.php\">"._GOTONEWSINDEX."</a> | <a href=\"topicos.php\">"._SELECTNEWTOPIC."</a> ]</center>";
    } else {
        echo 
"<center><font class=\"title\">$sitename: $topic_title</font><br><br>"
        
."<form action=\"buscar.php\" method=\"post\">"
        
."<input type=\"hidden\" name=\"topic\" value=\"$new_topic\">"
        
.""._SEARCHONTOPIC.": <input type=\"name\" name=\"query\" size=\"30\">&nbsp;&nbsp;"
        
."<input type=\"submit\" value=\""._SEARCH."\">"
        
."</form>"
        
."[ <a href=\"index.php\">"._GOTOHOME."</a> | <a href=\"topicos.php\">"._SELECTNEWTOPIC."</a> ]</center>";
    }
    
CloseTable();
    echo 
"<br>";
    }
#Page Numbers ver1.0
    
if ($pagenum == "") { $pagenum ; }
    
$offset = ($pagenum-1) * $storynum ;
    
#$result = sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $storynum", $dbi);
    
$result sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $offset, $storynum"$dbi);
#END
    
while (list($s_sid$catid$aid$title$time$hometext$bodytext$comments$counter$topic$informant$notes$acomm$score$ratings) = sql_fetch_row($result$dbi)) {
    if (
$catid 0) {
        list(
$cattitle) = sql_fetch_row(sql_query("select title from ".$prefix."_stories_cat where catid='$catid'"$dbi), $dbi);
    }
    
getTopics($s_sid);
    
formatTimestamp($time);
        
$subject stripslashes($subject);
        
$hometext stripslashes($hometext);
        
$hometext smile($hometext);
        
$hometext bbencode($hometext);
        
$hometext nl2br($hometext);
        
$notes stripslashes($notes);
        
$introcount strlen($hometext);
        
$fullcount strlen($bodytext);
        
$totalcount $introcount $fullcount;
        
$c_count $comments;
        
$r_options "";
        if (isset(
$cookie[4])) { $r_options .= "&amp;mode=$cookie[4]"; }
        if (isset(
$cookie[5])) { $r_options .= "&amp;order=$cookie[5]"; }
        if (isset(
$cookie[6])) { $r_options .= "&amp;thold=$cookie[6]"; }
    if (
is_user($user)) {
        
$the_icons " | <a href=\"imprimir.php?sid=$s_sid\"><img src=\"images/print.gif\" border=\"0\" Alt=\""._PRINTER."\" width=\"16\" height=\"11\"></a>&nbsp;&nbsp;<a href=\"recomendar.php?op=FriendSend&amp;sid=$s_sid\"><img src=\"images/friend.gif\" border=\"0\" Alt=\""._FRIEND."\" width=\"16\" height=\"11\"></a>";
    } else {
        
$the_icons "";
    }
    
$story_link "<a href=\"articulo.php?sid=$s_sid$options\">";
    
$morelink "(";
    if ((
$fullcount 0) OR ($c_count 0)) {
        
$morelink .= "$story_link<b>"._READMORE."</b></a> | ";
    } else {
        
$morelink .= "";
    }
    if (
$fullcount 0) { $morelink .= "$totalcount "._BYTESMORE." | "; }
    if (
$articlecomm == AND $acomm == 0) {
        if (
$c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; } elseif ($c_count 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; }
    }
    if (
$fullcount == AND $acomm == 1) {
        
$morelink .= "$story_link<b>"._READMORE."</b></a>";
        if (!
is_user($user)) {
        
$morelink .= " | ";
        }
    }
    
$morelink .= "$the_icons";
    
$sid $s_sid;
    if (
$catid != 0) {
        
$resultm sql_query("select title from ".$prefix."_stories_cat where catid='$catid'"$dbi);
        list(
$title1) = sql_fetch_row($resultm$dbi);
        
$title "<a href=\"categorias.php?op=newindex&amp;catid=$catid\"><font class=\"storycat\">$title1</font></a>: $title";
        
$morelink .= " | <a href=\"categorias.php?op=newindex&amp;catid=$catid\">$title1</a>";
    }
    if (
$score != 0) {
        
$rated substr($score $ratings04);
    } else {
        
$rated 0;
    }
    
$morelink .= " | "._SCORE." $rated";
    
$morelink .= ")";
    
$morelink str_replace(" |  | "" | "$morelink);
    
themeindex($aid$informant$datetime$title$counter$topic$hometext$notes$morelink$topicname$topicimage$topictext);
    }

#Page Numbers ver1.0
#Page Numbers ver1.2 - add 'where ihome=0' to only select stories with 'Publish In Home=Yes'
#Page Numbers ver1.3 - add check for new_topic being set (Topics don't look at 'Publish In Home' unlike News)
#Page Numbers ver1.4.2
    
if(isset($new_topic)) {
            
$res sql_query("select * from ".$prefix."_stories where topic=".$new_topic$dbi);
    } else {
            
$res sql_query("select * from ".$prefix."_stories where ihome=0"$dbi);
    }
    
$numstories sql_num_rows($res$dbi);
    
$numpages ceil($numstories $storynum);
#Page Numbers ver1.1 - added 'and $new_topic == 0'
#Page Numbers ver1.3 - remove 'and $new_topic == 0'
    #if ($numpages > 1 and $new_topic == 0) {
    
if ($numpages 1) {
#Page Numbers ver1.4 - add opentable(),closetable() to put Page Numbers in a box
            
opentable();
            echo 
"<center>$numstories Noticias ($numpages Paginas, $storynum Por Pagina)<br>" ;
#Page Numbers ver1.4 - add left/right navigation arrows
            
if ($pagenum 1) {
                    
$prevpage $pagenum ;
#Page Numbers ver1.4 - check for location of left/right arrow images
#Page Numbers ver1.4.1 - add align=absmiddle for left/right arrows
                    
if(file_exists("images/download/left.gif")) { 
                            
$leftarrow "images/download/left.gif" ;  # 5.x
                    
} else {
                            
$leftarrow "images/left.gif" ;           # 6.x
                    
}
                    if(isset(
$new_topic)) {
                            echo 
"<a href=\"modules.php?name=Noticias&amp;new_topic=$new_topic&amp;pagenum=$prevpage\"><img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
                    } else {
                            echo 
"<a href=\"modules.php?name=Noticias&amp;pagenum=$prevpage\"><img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
                    }
            }
            echo 
"[ " ;
            for (
$i=1$i $numpages+1$i++) {
                    if (
$i == $pagenum) {
#Page Numbers ver1.2 - bold the page number currently displaying for those who dont underline hyperlinks
                            
echo "<b>$i</b>";
                    } else {
#Page Numbers ver1.3 - add check for new_topic being set
                            
if(isset($new_topic)) {
                                    echo 
"<a href=\"modules.php?name=Noticias&amp;new_topic=$new_topic&amp;pagenum=$i\">$i</a>";
                            } else {
                                    echo 
"<a href=\"modules.php?name=Noticias&amp;pagenum=$i\">$i</a>";
                            }
                    }
                    if (
$i $numpages) { echo " | "; } else { echo " ]"; }
            }
            if (
$pagenum $numpages) {
                    
$nextpage $pagenum ;
#Page Numbers ver1.4 - check for location of left/right arrow images
                    
if(file_exists("images/download/right.gif")) { 
                            
$rightarrow "images/download/right.gif" ;  # 5.x
                    
} else {
                            
$rightarrow "images/right.gif" ;           # 6.x
                    
}
                    if(isset(
$new_topic)) {
                            echo 
"<a href=\"modules.php?name=Noticias&amp;new_topic=$new_topic&amp;pagenum=$nextpage\"><img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
                    } else {
                            echo 
"<a href=\"modules.php?name=Noticias&amp;pagenum=$nextpage\"><img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
                    }
            }
            echo 
"</center>" ;
#Page Numbers ver1.4 - add opentable(),closetable() to put Page Numbers in a box
            
closetable();
    }
#END

    
include("footer.php");
}

// El Codigo sigue con otras funciones de votacion y eso pero no tiene nada que ver
?>
Ya probe montonaso de cosas pero siempre termino con algun warning y no me anda nada

Bueno espero que me puedan ayudar, Gracias

Saludos