Qwilm!2

phpBB :: MOSTRAR ULTIMOS 10 MENSAJES

Mucho gente me ha preguntado como puede verse los ultimos post con las respuesta respectivamente. Bueno solo tendrian que colocar estos codigos en el lugar que les guste y que se vean los usuarios:

  1. //limite de sacadas de la base de datos
  2. $limit = 12;
  3. $result = mysql_query("SELECT t.topic_title, topic_replies, t.forum_id, t.topic_id, t.forum_id, p.post_id FROM phpbb_posts p INNER JOIN phpbb_topics t ON (p.topic_id = t.topic_id) ORDER BY p.post_time desc LIMIT $limit") or die(mysql_error());
  4. //url de tu foro
  5. $phpbb_root_path = 'foro';
  6. $topic_number = 1;
  7. $termino_frase = '…';
  8. while($foro = mysql_fetch_array($result)){
  9. $termino_frase = "…"; //Al termino de la frase que se mostrara, diría: …
  10. $n_letras = "39";
  11. $id = $foro[’post_id’];
  12. $foroid = $foro[’forum_id’];
  13. $titulo = $foro[’topic_title’];
  14. $url = $url_path . $phpbb_root_path.’viewtopic.php?p=’.$id.’&sid=’.$foroid.’#’.$id;
  15. $titulo = substr($titulo,0,39);
  16. if (strlen($foro[’topic_title’])>$n_letras){$titulo = $titulo.$termino_frase;}
  17. echo '<a title="'.$foro['topic_title'].'" href="'.$url.'" target="'._blank.'">'.ucwords(strtolower($titulo)).'</a> [Resp: '.$foro['topic_replies'].']
  18. ';
  19. }
  20. ?&gt;

[ 3C ] [ Octubre 21, 2006 ] [ Lenguaje PHP ]

Posts Relacionados
  1. Gravatar GP Kyo
    Octubre 31st, 2006 at 15:24

    mysql_select_db(”kyo_phpbb1″,$con);

    mmm, me parece conocido
    ¡ah! si era mi antigua base de datos XD

    buenos codigos, aun no entiendo el de url amigables T_T

    saludos

  2. Gravatar vhyllkuns
    Noviembre 10th, 2006 at 18:58

    Jajaja no me habia percatado es que lo saque del foro ya que tenia flojera de editarlo otra vez, gracias por avisarme de esto. xD!

  3. Gravatar tineo-kun
    Noviembre 29th, 2006 at 16:56

    hahaha oie y esto se lioga a la base de datos no?
    bueno gracias por el tip y el codigo xD