Cerrar Ventana

Algunas cookies de este sitio son esenciales, y el sitio no funcionará como se espera sin ellas. Estas cookies se establecen en el momento de enviar un formulario, inicie sesión o interactuar con el sitio realizando una acción que va más allá de hacer clic en un simple enlace.


Leer Más

Somos un foro de soporte en español que no tiene publicidad y tiene muchas cosas gratuitas aportadas por la comunidad, contribuye con el foro para poder así obtener alguna membresía de manera gratuita.
SoporteMyBB tiene un total de
1124 temas de soporte.
0 quedan aún por resolver, 244 han quedado obsoletos y 880 han sido resueltos.
Aún no tienes una cuenta, regístrate es gratis.

Calificación:
  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Ultimos temas en el inicio del foro.
 Whiteneo
Equipo de Soporte

Estado: Sin conexión Soporte Técnico
354
4,693
Mexico
5
93
576
1 July 2014, 23:09
#1
3
Mejor respuesta del mensaje Ultimos temas en el inicio del foro.Para esto vamos a hacer algunos cambios, primero que nada vamos a tomar el archivo index.php y justo al comienzo van a encontrar esto:

$plugins->run_hooks("index_start");

Debajo vamos a agregar:
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if($unviewable)
{
    $unviewwhere = " AND fid NOT IN ($unviewable)";
    $tunviewwhere = " AND t.fid NOT IN ($unviewable)";
}

// get inactive forums
$inactive = get_inactive_forums(true);
if($inactive)
{
    $inactivewhere = " AND fid NOT IN ($inactive)";
    $tinactivewhere = " AND t.fid NOT IN ($inactive)";
}

// Latest forum discussions

    $altbg = alt_trow();
    $threadlist = '';
    $query = $db->query("
        SELECT t.*, u.username, u.usergroup, u.displaygroup, u.avatar, u.uid
        FROM ".TABLE_PREFIX."threads t
        LEFT JOIN ".TABLE_PREFIX."users u ON (u.username=t.lastposter)
        WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
        ORDER BY t.lastpost DESC
        LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
    );
    while($thread = $db->fetch_array($query))
    {
        $forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);

        // Make sure we can view this thread
        if($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
        {
            continue;
        }

        $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
        $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
        // Don't link to guest's profiles (they have no profile).
        if($thread['lastposteruid'] == 0)
        {
            $lastposterlink = $thread['lastposter'];
            $lastposteravatar = $thread['avatar'];
        }
        else
        {
        $thread['lastposter'] = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
        $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
        $avatar = "<img src=\"".htmlspecialchars_uni($thread['avatar'])."\" class=\"avatar_img\" alt=\"\" /></a>";
        $avatarlink = build_profile_link($avatar, $thread['lastposteruid']);
        $avatar_none = "<img src=\"images/default_avatar.gif\" class=\"avatar_img\" alt=\"\" />";
        $avatarlink_none = build_profile_link($avatar_none, $thread['lastposteruid']);        
            if($thread['avatar'] == ''){
            $lastpostavatar = $avatarlink_none;
            }
            else{
            $lastpostavatar = $avatarlink;    
            }
        }
        if(my_strlen($thread['subject']) > 50)
        {
            $thread['subject'] = my_substr($thread['subject'], 0, 50) . "...";
        }
        $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
        $thread['threadlink'] = get_thread_link($thread['tid']);
        $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");

        eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
        $altbg = alt_trow();
    }
    if($threadlist)
    {
        // Show the table only if there are threads
        eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
    }

Luego de esto vamos a ir a estilos y plantillas guardando nuestro archivo index.php y subiendolo al FTP.

Portal plantillas - portal_latestthreads_thread

Cambismos todo por:

<tr>
<td class="{$altbg}">
<strong><a href="{$mybb->settings['bburl']}/{$thread['threadlink']}">{$thread['subject']}</a></strong>
<table>
<tr>
<td width="20%">
{$lastpostavatar}
</td>
<td class="smalltext">
<a href="{$thread['lastpostlink']}">{$lang->latest_threads_lastpost}</a> {$lastposterlink}<br />
{$lastpostdate} {$lastposttime}<br />
<strong>&raquo; </strong>Replies: {$thread['replies']} - Views: {$thread['views']}
</td>
</tr>
</table>
</td>
</tr>

Ahora en Índice Plantillas - index

Buscamos
{$forums}

Lo cambios por:

<div class="forums_a">
{$forums}
</div>
<div class="forums_lt">
{$latestthreads}
</div>

Finalmente en tu archivo global al final agregamos esto:

.forums_a{
   width: 78%;
   float:left;
}

.forums_lt{
   width: 20%;f
   loat:right;
}

.avatar_img {
   width: 30px;
   height: 30px;
   border: #000 1px solid;
   border-radius: 3px;
   padding: 3px;
}

Actualizar la cache y listo !!!

El rsultado final sería asi:

   

NOTA: Este manual lo he realizado porque me lo han pedido muchas ocasiones y ahora mismo lo comparto ya que muchos usuarios no lo tienen, tienen el normal que muestra los datos del mensaje primero que se creo y bueno este es con los últimos envios ya que es el que falta en la red, saludos...
 
 Garra8
Usuario del Foro

Estado: Sin conexión Registrados
7
57
1
Spain
0
0
1
31
17 September 2014, 19:04
#2
0
(1 July 2014, 23:09 )Dark Neo escribió: Registrate o inicia tu sesión para ver este contenidoPara esto vamos a hacer algunos cambios, primero que nada vamos a tomar el archivo index.php y justo al comienzo van a encontrar esto:


$plugins->run_hooks("index_start");

Debajo vamos a agregar:

// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if($unviewable)
{
    $unviewwhere = " AND fid NOT IN ($unviewable)";
    $tunviewwhere = " AND t.fid NOT IN ($unviewable)";
}

// get inactive forums
$inactive = get_inactive_forums(true);
if($inactive)
{
    $inactivewhere = " AND fid NOT IN ($inactive)";
    $tinactivewhere = " AND t.fid NOT IN ($inactive)";
}

// Latest forum discussions

    $altbg = alt_trow();
    $threadlist = '';
    $query = $db->query("
        SELECT t.*, u.username, u.usergroup, u.displaygroup, u.avatar, u.uid
        FROM ".TABLE_PREFIX."threads t
        LEFT JOIN ".TABLE_PREFIX."users u ON (u.username=t.lastposter)
        WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
        ORDER BY t.lastpost DESC
        LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
    );
    while($thread = $db->fetch_array($query))
    {
        $forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);

        // Make sure we can view this thread
        if($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
        {
            continue;
        }

        $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
        $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
        // Don't link to guest's profiles (they have no profile).
        if($thread['lastposteruid'] == 0)
        {
            $lastposterlink = $thread['lastposter'];
            $lastposteravatar = $thread['avatar'];
        }
        else
        {
        $thread['lastposter'] = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
        $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
        $avatar = "<img src=\"".htmlspecialchars_uni($thread['avatar'])."\" class=\"avatar_img\" alt=\"\" /></a>";
        $avatarlink = build_profile_link($avatar, $thread['lastposteruid']);
        $avatar_none = "<img src=\"images/default_avatar.gif\" class=\"avatar_img\" alt=\"\" />";
        $avatarlink_none = build_profile_link($avatar_none, $thread['lastposteruid']);        
            if($thread['avatar'] == ''){
            $lastpostavatar = $avatarlink_none;
            }
            else{
            $lastpostavatar = $avatarlink;    
            }
        }
        if(my_strlen($thread['subject']) > 50)
        {
            $thread['subject'] = my_substr($thread['subject'], 0, 50) . "...";
        }
        $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
        $thread['threadlink'] = get_thread_link($thread['tid']);
        $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");

        eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
        $altbg = alt_trow();
    }
    if($threadlist)
    {
        // Show the table only if there are threads
        eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
    }

Luego de esto vamos a ir a estilos y plantillas guardando nuestro archivo index.php y subiendolo al FTP.

Portal plantillas - portal_latestthreads_thread

Cambismos todo por:


<tr>
<td class="{$altbg}">
<strong><a href="{$mybb->settings['bburl']}/{$thread['threadlink']}">{$thread['subject']}</a></strong>
<table>
<tr>
<td width="20%">
{$lastpostavatar}
</td>
<td class="smalltext">
<a href="{$thread['lastpostlink']}">{$lang->latest_threads_lastpost}</a> {$lastposterlink}<br />
{$lastpostdate} {$lastposttime}<br />
<strong>&raquo; </strong>Replies: {$thread['replies']} - Views: {$thread['views']}
</td>
</tr>
</table>
</td>
</tr>

Ahora en Índice Plantillas - index

Buscamos

{$forums}

Lo cambios por:


<div class="forums_a">
{$forums}
</div>
<div class="forums_lt">
{$latestthreads}
</div>

Finalmente en tu archivo global al final agregamos esto:


.forums_a{
  width: 78%;
  float:left;
}

.forums_lt{
  width: 20%;f
  loat:right;
}

.avatar_img {
  width: 30px;
  height: 30px;
  border: #000 1px solid;
  border-radius: 3px;
  padding: 3px;
}

Actualizar la cache y listo !!!

El rsultado final sería asi:



NOTA: Este manual lo he realizado porque me lo han pedido muchas ocasiones y ahora mismo lo comparto ya que muchos usuarios no lo tienen, tienen el normal que muestra los datos del mensaje primero que se creo y bueno este es con los últimos envios ya que es el que falta en la red, saludos...

se ve muy bueno y util dark neo.. vale para 1.8?
 
 Whiteneo
Equipo de Soporte

Estado: Sin conexión Soporte Técnico
354
4,693
Mexico
5
93
576
17 September 2014, 19:26
#3
0
Si es similar el cambio pero cambia en algunas cosas, aunque di puede funcionar. Pero alguien me pidio el cambio y esta puesto aqui en el foro. Saludos.
 
 eNvy
Usuario del Foro
eNvy
Estado: Sin conexión Registrados
36
252
180
Argentina
0
2
180
54
17 September 2014, 20:20
#4
0
Gran tutorial Dark, justamente alguien me pregunto de esto en MyBB, podrías subirlo allí, es una sugerencia.

Saludos!
 
 Jean Pierre
High Hopes

Estado: Sin conexión Registrados
24
291
112
Peru
0
0
112
22
17 September 2014, 20:39
#5
0
Había una manera de traer los últimos temas que aparecen en el portal, pero al index, con jQuery, no sé en dónde vi el tutorial pero creo recordar cómo era Gran sonrisa prácticamente es lo mismo que esto supongo.
 
 eNvy
Usuario del Foro
eNvy
Estado: Sin conexión Registrados
36
252
180
Argentina
0
2
180
54
17 September 2014, 20:43
#6
0
Aquí mismo está el tutorial, pero muestra la creación del tema junto con el primer mensaje, y aquí muestra sólo los últimos mensajes si mal no comprendí... Parece, pero no es exactamente lo mismo.
 
 Whiteneo
Equipo de Soporte

Estado: Sin conexión Soporte Técnico
354
4,693
Mexico
5
93
576
17 September 2014, 20:47
#7
0
Es mediante la funciob load de jquery anhidada al portal y con un id, algo sencillo y util que tenia en mi foro. A muchos del foro oficial se los pase porque me preguntaban como lo hice en mi foro antes de cerrarlo.
 


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
Video [Videotutorial] Crear temas en MyBB Whiteneo 6 2,929 20 August 2018, 23:52
Último mensaje: Adfe
  [Tutorial] Agregar temas por prefijos a la búsqueda Whiteneo 0 1,061 12 September 2015, 02:05
Último mensaje: Whiteneo
  [Tutorial] Colorpicker Agrega colores a tus temas con jQuery, Whiteneo 14 4,010 18 September 2014, 03:15
Último mensaje: Whiteneo
  Enviar temas por facebook angeluz 4 1,522 24 May 2014, 14:29
Último mensaje: papi
  Aumentar el número de caracteres en el título de los temas papi 0 837 16 March 2014, 13:36
Último mensaje: papi
  Elegir página de inicio con .htaccess papi 0 950 10 March 2014, 23:16
Último mensaje: papi
  Instalar temas en MyBB. Whiteneo 1 4,527 16 January 2014, 05:45
Último mensaje: lestat_shifo



Usuarios navegando en este tema: 1 invitado(s)