Boczny panel - ostatnie wątki

Założony przez  Robcionike.

wersja skryptu MyBB:1.6.7
adres forum:football4you.pl
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu): Witam. Jak dodać ostatnie wątki do bocznego panelu? Zainstalowałem plugin "Recent Topics Index Page", ale tabelka umieszczona jest pod działami, a ja chciałbym ją w panelu bocznym. Kolega z innego forum podał mi taki kod, abym wkleił do index.php
// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != && $mybb->settings['portal_showdiscussionsnum'])
{
    
$altbg alt_trow();
    
$threadlist '';
    
$query $db->query("
        SELECT t.*, u.username
        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, "
.$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'] == || $forumpermissions[$thread['fid']]['canviewthreads'] == || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == && $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'];
        }
        else
        {
            
$lastposterlink build_profile_link($thread['lastposter'], $thread['lastposteruid']);
        }
        if(
my_strlen($thread['subject']) > 25)
        {
            
$thread['subject'] = my_substr($thread['subject'], 025) . "...";
        }
        
$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")."\";");
    } 

I to wkleił w boczny panel...
{$latestthreads

Jednak gdy to robie, to jest błąd na forum jakiś i w ogóle nie ma ostatnich wątków w panelu bocznym...

Proszę o pomoc
PA->Style i Szablony->Szablony->TwójStyl->Strona Główna->index

Znajdujesz:
{$recenttopics}
77 linijka
Usuwasz to z miejsca w którym było i wklejasz w tabele do panelu bocznego.
Wszystko pięknie, cacy, tylko jak to teraz edytować, żeby wyglądało dokładnie tak samo jak tutaj?
(również tylko 5 ostatnich wątków i wygląd tego)

http://scr.hu/4l7/51e1v
Pokaż kod plugina.
Jeśli chcesz zrobić aby pokazywało tylko 5 ostatnich wątków to :

ACP->Konfiguracja->Ustawienia->Opcje Strony Głownej->Recent Topics To Show

Zmieniasz cyfrę na 5.

Pozdrawiam
Recenttopicsindex.php

<?php
/*
Recent Topics
by: vbgamer45
http://www.mybbhacks.com
Copyright 2011  MyBBHacks.com

############################################
License Information:

Links to http://www.mybbhacks.com must remain unless
branding free option is purchased.
#############################################
*/
if(!defined('IN_MYBB'))
    die(
'This file cannot be accessed directly.');

$plugins->add_hook("index_end""recenttopicsindex_show");

function 
recenttopicsindex_info()
{

    return array(
        
"name"        => "Recent Topics Index Page",
        
"description"        => "Adds Recent Topics to the index page",
        
"website"        => "http://www.mybbhacks.com",
        
"author"        => "vbgamer45",
        
"authorsite"        => "http://www.mybbhacks.com",
        
"version"        => "1.0.2",
        
"guid"             => "3244972b3e44b82b52b12594a6af9261",
        
"compatibility"    => "1*"
        
);
}


function 
recenttopicsindex_install()
{
    global 
$mybb$db;
    
// Create Tables/Settings
    
$db->query("INSERT  INTO ".TABLE_PREFIX."settings (sid, name, title, description, optionscode, value, disporder, gid) VALUES (NULL, 'recenttopicslimit', 'Recent Topics To Show', 'The number of recent topics you wish to display on the main index page', 'text', '10', 1, 6);");

    
rebuild_settings();


}

function 
recenttopicsindex_is_installed()
{
    global 
$db;
    
$query $db->write_query("SELECT * FROM " TABLE_PREFIX "settings WHERE `name` = 'recenttopicslimit'");

    if(
$db->num_rows($query) > 0)
        return 
true;
    else
        return 
false;
}

function 
recenttopicsindex_uninstall()
{
    global 
$mybb$db;

    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'recenttopicslimit'");

    
rebuild_settings();
}


function 
recenttopicsindex_activate()
{
  require_once 
MYBB_ROOT."/inc/adminfunctions_templates.php";

  
$returnStatus1 find_replace_templatesets("index""#".preg_quote('{$forums}') . "#i"'{$forums}' "\n" '{$recenttopics}');


}

function 
recenttopicsindex_deactivate()
{
  require_once 
MYBB_ROOT."/inc/adminfunctions_templates.php";

  
$returnStatus1 find_replace_templatesets(
  
"index""#".preg_quote('{$forums}' "\n" '{$recenttopics}') . "#i",
  
'{$forums}',0);


}

function 
recenttopicsindex_show()
{
    global 
$db$mybb$page$recenttopics$theme$lang$permissioncache;

    
$lang->load('recenttopicsindex');

    require_once 
MYBB_ROOT."inc/functions_search.php";

    if (empty(
$mybb->settings['recenttopicslimit']))
        
$mybb->settings['recenttopicslimit'] = 10;

    
$recenttopics .= '<table border="0" cellspacing="' $theme['borderwidth'] . '" cellpadding="' $theme['tablespace'] . '" class="tborder">
<thead>
<tr>
<td class="thead" colspan="2">

<div><strong>' 
$lang->recenttopics '</strong></div>
</td>
</tr>
</thead>'
;

    
// Run the Query
    
    // !!! FIX private forum exposure!!!
   
if ( !is_array($permissioncache) ||(is_array($permissioncache) && ((count($permissioncache)==1) && (isset($permissioncache['-1']) && ($permissioncache['-1'] = "1"))))) 
       
$permissioncache forum_permissions();

    
$unsearchforums get_unsearchable_forums();
    if(
$unsearchforums)
        
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";

    
$inactiveforums get_inactive_forums();
    if (
$inactiveforums)
        
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";


    
$query $db->query("
    SELECT
        t.tid, t.fid, t.subject, t.lastposteruid, t.lastposter, t.lastpost, f.name
    FROM "
.TABLE_PREFIX."threads as t,  ".TABLE_PREFIX."forums as f
    WHERE f.fid = t.fid AND t.visible = 1 
$where_sql
    ORDER BY t.lastpost DESC LIMIT " 
$mybb->settings['recenttopicslimit']);
    while(
$threadRow $db->fetch_array($query))
    {
        
$recenttopics .= '<tr>';
        
$subject my_substr($threadRow['subject'], 050);
        
$subject htmlspecialchars_uni($subject);
        
$postdate my_date($mybb->settings['dateformat'], $threadRow['lastpost']);
        
$posttime my_date($mybb->settings['timeformat'], $threadRow['lastpost']);

        
$recenttopics .= '<td class="trow1">
        <a href="showthread.php?tid=' 
$threadRow['tid'] . '&action=lastpost">' $subject .'</a> '  $lang->recenttopics_by . (!empty($threadRow['lastposteruid']) ? ' <a href="member.php?action=profile&uid=' $threadRow['lastposteruid'] . '">' $threadRow['lastposter'] . '</a>' $threadRow['lastposter']) . ' (<a href="forumdisplay.php?fid=' $threadRow['fid'] . '">' $threadRow['name'] . '</a>)
    
        </tr>'
;
    }


    
$recenttopics .= "</table><br />";



}


?>
No u mnie jest z boku.
Teraz co zrobić, żeby wyglądało jak to? http://scr.hu/4l7/51e1v ?
(Mniejsze litery, do góry tytuł pogrubiony, pod spodem autor i data)
<?php
/*
Recent Topics
by: vbgamer45
http://www.mybbhacks.com
Copyright 2011  MyBBHacks.com

############################################
License Information:

Links to http://www.mybbhacks.com must remain unless
branding free option is purchased.
#############################################
*/
if(!defined('IN_MYBB'))
    die(
'This file cannot be accessed directly.');

$plugins->add_hook("index_end""recenttopicsindex_show");

function 
recenttopicsindex_info()
{

    return array(
        
"name"        => "Recent Topics Index Page",
        
"description"        => "Adds Recent Topics to the index page",
        
"website"        => "http://www.mybbhacks.com",
        
"author"        => "vbgamer45",
        
"authorsite"        => "http://www.mybbhacks.com",
        
"version"        => "1.0.2",
        
"guid"             => "3244972b3e44b82b52b12594a6af9261",
        
"compatibility"    => "1*"
        
);
}


function 
recenttopicsindex_install()
{
    global 
$mybb$db;
    
// Create Tables/Settings
    
$db->query("INSERT  INTO ".TABLE_PREFIX."settings (sid, name, title, description, optionscode, value, disporder, gid) VALUES (NULL, 'recenttopicslimit', 'Recent Topics To Show', 'The number of recent topics you wish to display on the main index page', 'text', '10', 1, 6);");

    
rebuild_settings();


}

function 
recenttopicsindex_is_installed()
{
    global 
$db;
    
$query $db->write_query("SELECT * FROM " TABLE_PREFIX "settings WHERE `name` = 'recenttopicslimit'");

    if(
$db->num_rows($query) > 0)
        return 
true;
    else
        return 
false;
}

function 
recenttopicsindex_uninstall()
{
    global 
$mybb$db;

    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'recenttopicslimit'");

    
rebuild_settings();
}


function 
recenttopicsindex_activate()
{
  require_once 
MYBB_ROOT."/inc/adminfunctions_templates.php";

  
$returnStatus1 find_replace_templatesets("index""#".preg_quote('{$forums}') . "#i"'{$forums}' "\n" '{$recenttopics}');


}

function 
recenttopicsindex_deactivate()
{
  require_once 
MYBB_ROOT."/inc/adminfunctions_templates.php";

  
$returnStatus1 find_replace_templatesets(
  
"index""#".preg_quote('{$forums}' "\n" '{$recenttopics}') . "#i",
  
'{$forums}',0);


}

function 
recenttopicsindex_show()
{
    global 
$db$mybb$page$recenttopics$theme$lang$permissioncache;

    
$lang->load('recenttopicsindex');

    require_once 
MYBB_ROOT."inc/functions_search.php";

    if (empty(
$mybb->settings['recenttopicslimit']))
        
$mybb->settings['recenttopicslimit'] = 10;

    
$recenttopics .= '<table border="0" cellspacing="' $theme['borderwidth'] . '" cellpadding="' $theme['tablespace'] . '" class="tborder">
<thead>
<tr>
<td class="thead" colspan="2">

<div><strong>' 
$lang->recenttopics '</strong></div>
</td>
</tr>
</thead>'
;

    
// Run the Query
    
    // !!! FIX private forum exposure!!!
   
if ( !is_array($permissioncache) ||(is_array($permissioncache) && ((count($permissioncache)==1) && (isset($permissioncache['-1']) && ($permissioncache['-1'] = "1"))))) 
       
$permissioncache forum_permissions();

    
$unsearchforums get_unsearchable_forums();
    if(
$unsearchforums)
        
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";

    
$inactiveforums get_inactive_forums();
    if (
$inactiveforums)
        
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";


    
$query $db->query("
    SELECT
        t.tid, t.fid, t.subject, t.lastposteruid, t.lastposter, t.lastpost, f.name
    FROM "
.TABLE_PREFIX."threads as t,  ".TABLE_PREFIX."forums as f
    WHERE f.fid = t.fid AND t.visible = 1 
$where_sql
    ORDER BY t.lastpost DESC LIMIT " 
$mybb->settings['recenttopicslimit']);
    while(
$threadRow $db->fetch_array($query))
    {
        
$recenttopics .= '<tr>';
        
$subject my_substr($threadRow['subject'], 050);
        
$subject htmlspecialchars_uni($subject);
        
$postdate my_date($mybb->settings['dateformat'], $threadRow['lastpost']);
        
$posttime my_date($mybb->settings['timeformat'], $threadRow['lastpost']);

        
$recenttopics .= '<td class="trow1">
        <a href="showthread.php?tid=' 
$threadRow['tid'] . '&action=lastpost"><strong>' $subject .'</a></strong></br> '  $lang->recenttopics_by . (!empty($threadRow['lastposteruid']) ? ' <a href="member.php?action=profile&uid=' $threadRow['lastposteruid'] . '">' $threadRow['lastposter'] . '</a>' $threadRow['lastposter']) . '
    
        </tr>'
;
    }


    
$recenttopics .= "</table><br />";



}


?>
Możesz zainstalować plugin Sideboxes. Potem odznaczyć wszystko w jego ustawieniach. Następnie przejść do kodu swojego sidebaru i w miejsce {$latestthreads} wkleić {$sb_latestthreads}. To moim zdaniem najlepsze rozwiązanie :) gdyż sam dostosuje się do stylu na forum.



Użytkownicy przeglądający ten wątek:

1 gości