Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/05/2006, 14:49
finord
 
Fecha de Ingreso: mayo-2005
Mensajes: 51
Antigüedad: 18 años, 11 meses
Puntos: 0
paginar los mensajes de un foro phpbb

Wenas aqui va el problema, necesito mostrar el titulo de todos los mensajes del foro, pero como estos son un numero muy alto..habia pensado en usar un paginador..pero mi conocimiento de php no llega tanto, he estado un buen tiempo..pero no lo he conseguido..asi que si alguien puede ayudarme los agradeceria ^^

La base es un script que saca los X ultimos mensajes de un foro, aqui os pongo el codigo
Código PHP:
 <?php 

  
include ('xxx');
  
// el carrito de compra necesita  sesiones, así que iniciamos una

  
do_html_header("xxx");


define('IN_PHPBB'true); 
$phpbb_root_path 'foro/'
include(
$phpbb_root_path 'extension.inc'); 
include(
$phpbb_root_path 'common.'.$phpEx); 

// 
// Start session management 
// 
$no_mostrar "0";
$userdata session_pagestart($user_ipPAGE_INDEX); 
init_userprefs($userdata); 
$auth_ary auth(AUTH_READAUTH_LIST_ALL$userdata); 
while ( list(
$auth_forum_id$auth_level) = each($auth_ary) ) 

    if (!
$auth_level['auth_read'] ) 
    { 
        
$auth_view_forums = ($auth_view_forums " p.forum_id <> " $auth_forum_id " and "); 
        
$auth_view_forums1 = ($auth_view_forums1 " forum_id <> " $auth_forum_id " and "); 
    } 

$auth_view_forums="WHERE " $auth_view_forums
?> 

  <? 
$sql_ini
=mysql_query("SELECT distinct topic_id FROM ".POSTS_TABLE." p $auth_view_forums 1 ORDER BY p.post_time DESC"); 
while (
$assoc=mysql_fetch_assoc($sql_ini)) 
    foreach (
$assoc as $value
    { 

        
$sql=mysql_query("SELECT t.topic_last_post_id, t.topic_title, t.topic_id, t.topic_time, t.topic_replies, u.username,u.user_id, f.forum_name, f.forum_id, p.post_id, p.post_time FROM ".POSTS_TABLE." p, ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".FORUMS_TABLE." f WHERE t.topic_poster=u.user_id AND t.topic_id=".$value." AND p.post_id=t.topic_last_post_id AND t.forum_id=f.forum_id AND f.forum_id NOT IN ($no_mostrar) ");
        while (
$assoc=mysql_fetch_assoc($sql)) 
        { 
            
$sql1=mysql_query("SELECT u.username FROM ".POSTS_TABLE." p, ".USERS_TABLE." u WHERE p.post_id=".$assoc['topic_last_post_id']." AND  p.poster_id=u.user_id"); 
            
$ultimo_usuario=mysql_fetch_assoc($sql1); 
            
$ultimo_usuario=$ultimo_usuario['username']; 
            
$fecha_ultimo=getdate($assoc['post_time']); 
            
$fecha_ultimo=$fecha_ultimo["mday"]."-".$fecha_ultimo["mon"]."-".$fecha_ultimo["year"]; 
            
$fecha_abierto=getdate($assoc['topic_time']); 
            
$fecha_abierto=$fecha_abierto["mday"]."-".$fecha_abierto["mon"]."-".$fecha_abierto["year"]; 
            
?> 

    
        <strong>-</strong><a href="<?=$phpbb_root_path?>viewtopic.php?p=<?=$assoc['post_id']?>&highlight=#<?=$assoc['post_id']?>"> 
            <?=( ( strlen $assoc["topic_title"] ) > 20 ) ? ( substr $assoc["topic_title"] , 50 )) : $assoc["topic_title"] )?></a>
            <? echo $fecha_abierto?>
<br>
<? 
    }
    
ob_end_flush();
    
?>
gracias y salu2

Última edición por finord; 24/05/2006 a las 14:56