Quantcast
Channel: MyBB-Es.com - Todos los foros
Viewing all articles
Browse latest Browse all 4047

ultimos temas en el index sin plugin

$
0
0
Bueno como no vi este tutorial aqui,ahi se los dejo

Antes de enpezar asegurence de tener instalado el notepad++ ya que si piensan copiar y pegar de frente en sus plantillas los codigos que les voy a dar no lo hagan primero pegen todo en el notepad ++ para evitar que se copien caracteres que pueden causar errores.

Primero debemos crear las cajitas donde se mostraran los ultimos temas.

vamos al stylo de su plantilla en global.css al final agregar esto..

Código:
.box1 {    
width:74%;
float:left;
}
        
.box2 {    
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
float: left;
width: 24%;
margin: 0px 0px 10px 10px;
}



luego van a su set de plantillas y buscan la plantilla de su index

y pegan el siguiente codigo

Código:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
lang.no_new_posts = "{$lang->no_new_posts}";
lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body>
{$header}
<div class="box1">
{$forums}
</div>

<div class="box2" >
{$latestthreads}
<br />


</div>
{$boardstats}

<dl class="forum_legend smalltext">
<dt><img src="{$theme['imgdir']}/on.gif" alt="{$lang->new_posts}" title="{$lang->new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
<dd>{$lang->new_posts}</dd>

<dt><img src="{$theme['imgdir']}/off.gif" alt="{$lang->no_new_posts}" title="{$lang->no_new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
<dd>{$lang->no_new_posts}</dd>

<dt><img src="{$theme['imgdir']}/offlock.gif" alt="{$lang->forum_locked}" title="{$lang->forum_locked}" style="vertical-align: middle;" /></dt>
<dd>{$lang->forum_locked}</dd>
</dl>
<br style="clear: both" />
{$footer}
</body>
</html>


Ahora vamos al set de plantillas Portal-plantillas-> plantilla portal_latestthreads_thread y reemplazamos todo por este codigo.

Código:
<tr>
<td class="{$altbg}">
<img width="30px" height="30px"src="{$thread['avatar_thread']}">
<strong><a href="{$mybb->settings['bburl']}/{$thread['threadlink']}">{$thread['subject']}</a></strong>
<span class="smalltext"><br />
<a href="{$thread['lastpostlink']}">{$lang->latest_threads_lastpost}</a> {$lastposterlink}<br />
{$lastpostdate} {$lastposttime}<br />
<strong>&raquo; </strong>{$lang->latest_threads_replies} {$thread['replies']}<br />
<strong>&raquo; </strong>{$lang->latest_threads_views} {$thread['views']}
</span>
</td>
</tr>



Les quedara como en la imagen un espacio vacio





Ahora tenemos
que ir al archivo index.php que esta en la raiz de nuestro foro y buscar

Código:
$lang->load("index");



abajo de eso colocamos el siguiente codigo

Código:
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if($unviewable)
{
        $unviewwhere = " AND fid NOT IN ($unviewable)";
}

        $altbg = alt_trow();
    $threadlist = '';
    $query = $db->query("
        SELECT t.*, u.username,u.avatar
        FROM ".TABLE_PREFIX."threads t
        LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
        WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
        ORDER BY t.lastpost DESC
        LIMIT 0, 10"
    ;);
        while($thread = $db->fetch_array($query))
    {
        $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'];
        }
        else
        {
            $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
        }
        if(my_strlen($thread['subject']) > 25)
        {
            $thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
        }
        $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");
        $thread['avatar_thread'] = $thread['avatar'];
        eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
        $altbg = alt_trow();
    }
    $l['latest_threads_views'] = "Vistas:";
    if($threadlist)
    {
        // Show the table only if there are threads
        eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
    }





Ahora vamos al archivo inc\languages\espanol\index.lang.php obviamente tienen que poner el lenguaje que usan en la ruta.

y agregamos en cualquier parte estos dos codigos.

Código:
$l['latest_threads_replies'] = "Respuestas:";
$l['latest_threads_views'] = "Vistas:";



Al final quedaria asi mostrando el avatar incluido.Y si quieren poner los ultimos temas en otra parte del index solo juegen con la variable
Código:
{$latestthreads}
a su gusto.



Posdata todo esto se hizo con el thema default de mybb.

Viewing all articles
Browse latest Browse all 4047

Trending Articles