Bueno amigos, me puse en contacto con el creador del MOD que me pasasteis y me ayudo a conseguir lo que necesitaba de muy buena gana. Asi que ahora os lo pongo yo aqui para que la gente que lo necesite lo pueda poner en sus foros.
Primero decir que esto lo he usado en ezportal, la unica diferencia es añadir el ultimo include en el index.php o en el portal.php
1.- Crea un archivo llamado ultimos.php con este contenido
Código: Seleccionar todo
<?
$template->set_filenames(array(
'ultimos' => 'ultimos.tpl')
);
$foro_query = " p.forum_id=" . $ultimosForoId;
$sql_ini=("SELECT distinct p.topic_id FROM ".POSTS_TABLE." p, ".TOPICS_TABLE." t WHERE $foro_query and p.topic_id=t.topic_id ORDER BY t.topic_last_post_id DESC LIMIT 0,10");
if ( !($result_ini = $db->sql_query($sql_ini)) )
{
message_die(GENERAL_ERROR, 'No se pudo obtener últimos temas', '', __LINE__, __FILE__, $sql_ini);
}
while ( $assoc_ini=$db->sql_fetchrow($result_ini) )
// Para cada topic_id obtenido extraeremos datos necesarios en dos querys
{
// Segunda query todos los datos menos el ultimo usuario
$sql=("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=".$assoc_ini['topic_id']." AND p.post_id=t.topic_last_post_id AND t.forum_id=f.forum_id");
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'No se pudo obtener últimos temas', '', __LINE__, __FILE__, $sql);
}
while ( $assoc=$db->sql_fetchrow($result) )
{
// tercera query ultimo posteador
$sql_last=("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");
if ( !($result_last = $db->sql_query($sql_last)) )
{
message_die(GENERAL_ERROR, 'No se pudo obtener últimos temas', '', __LINE__, __FILE__, $sql_last);
}
$ultimo_usuario=$db->sql_fetchrow($result_last);
$ultimo_usuario=$ultimo_usuario['username'];
$db->sql_freeresult($result_last);
$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"];
$foro_nombre = $assoc['forum_name'];
$template->assign_block_vars('ultimos', array(
'LINK_TITULO' => append_sid( "viewtopic.$phpEx?p=".$assoc['post_id']."&highlight=#".$assoc['post_id'] ),
'TITULO' => ( ( strlen ( $assoc["topic_title"] ) > 19 ) ? ( substr ( $assoc["topic_title"] , 0 , 19 ) . "..." ) : $assoc["topic_title"] ),
'LINK_FORO' => append_sid( "viewforum.$phpEx?f=".$assoc["forum_id"] ),
'FORO' => ( ( strlen ( $assoc["forum_name"] ) > 19 ) ? ( substr ( $assoc["forum_name"] , 0 , 19 ) . "..." ) : $assoc["forum_name"] ),
'LINK_CREADOR_TEMA' => append_sid( "profile.$phpEx?mode=viewprofile&u=".$assoc["username"] ),
'CREADOR_TEMA' => $assoc["username"],
'CREADOR_FECHA' => $fecha_abierto,
'LINK_AUTOR_ULTIMO' => append_sid( "profile.$phpEx?mode=viewprofile&u=".$ultimo_usuario ),
'AUTOR_ULTIMO' => $ultimo_usuario,
'FECHA_ULTIMO' => $fecha_ultimo,
'RESPUESTAS' => $assoc["topic_replies"]));
}
$db->sql_freeresult($result);
}
$db->sql_freeresult($result_ini);
$template->assign_vars(array(
'FORO_NOMBRE' => ( ( $foro == "" ) ? "TODOS LOS FOROS" : $foro_nombre ),
'INDICE' => append_sid("index.$phpEx" ) ) );
make_jumpbox('index.'.$phpEx);
$template->pparse('ultimos');
$template->destroy('ultimos');
?>
2.- Sube este archivo al directorio raiz de tu phpbb
3.- Crea un archivo llamado ultimos.tpl con este contenido.
Código: Seleccionar todo
<table align="center" class="forumline" width="100%">
<tr align="right">
<td class="catHead" colspan="5" height="28"><span class="cattitle"><a href="#" class="cattitle">Últimos mensajes en los foros :: {FORO_NOMBRE}</a></span></td>
</tr>
<tr>
<th colspan="2">
Título - Foro
</th>
<th>
Abierto por
</th>
<th>
Último mensaje
</th>
<th>
Respuestas
</th>
</tr>
<!-- BEGIN ultimos -->
<tr>
<td class="row1" align="center" height="28">
<span class="gensmall">
<a href="{ultimos.LINK_TITULO}">
{ultimos.TITULO}
</a>
</span>
</td>
<td class="row1" align="center" height="28">
<span class="gensmall">
<a href="{ultimos.LINK_FORO}">
{ultimos.FORO}
</a></span>
</td>
<td class="row1" align="center" height="28">
<span class="gensmall">
<a href="{ultimos.LINK_CREADOR_TEMA}">
{ultimos.CREADOR_TEMA}
</a> </span>
<span class="gensmall" height="28">
el {ultimos.CREADOR_FECHA}</span>
</td>
<td class="row1" align="center" height="28">
<span class="gensmall">
<a href="{ultimos.LINK_AUTOR_ULTIMO}">
{ultimos.AUTOR_ULTIMO}
</a> </span>
<span class="gensmall">
el {ultimos.FECHA_ULTIMO}</span>
<td class="row1" align="center" height="28">
<span class="gensmall">
{ultimos.RESPUESTAS}</span>
</td>
</tr>
<!-- END ultimos -->
<tr>
<td class="row3" colspan="2" align="center">
<span class="gensmall"><a href="{INDICE}">Todos los foros</a></span></td>
<td class="row3" colspan="3" align="center">
{JUMPBOX}</td>
</tr>
</table>
4.- Subir este archivo al directorio del template que useis.
5.- Abrir vuestro archivo portal.php si lo vais a poner en ezportal o index.php si lo vais a poner en vuestro foro y buscar la siguiente linea
Código: Seleccionar todo
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
6.- Añadir despues de esto, el siguiente codigo cambiando el id_del_foro por el id de los foros que querais poner.
7.- Si quereis poner mas de un bloque solo teneis que añadir tantos de esos como necesiteis, acordandoos de cambiar el id_del_foro. Un saludo y muchas gracias al creado del MOD y los que me ayudaron.