Ostatnie posty w pasku bocznym

Założony przez  SLAVOO.

wersja skryptu MyBB: 1.6.9
adres forum: insidery.cba.pl
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu):

Wpadłem na pewien pomysł i mam pytanie.
Aktualnie w rozwijanym panelu bocznym mam Ostatnie wątki/posty z wykorzystaniem pluginu recent topic index page 1.0.2. Wszystko działa, ale pod względem estetycznym nie jestem zadowolony.
Kiedy otworzy się moją stronę z końcówką /portal.php jest tam (tym razem z lewej strony) ostatnie posty takie jakbym chciał jeśli chodzi o wygląd.

Jeśli dodam szablon portal_latestthreads z Szablony - Portal
do index, do paska bocznego to nie działa. Dlaczego?

Portal kod:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/fitonpage.js?ver=230"></script>
<script type="text/javascript">
<!--
    var fitonpage_on = "{$mybb->settings['g33k_fitonpage_enabled']}";
    var fitonpage_resize = "{$mybb->settings['g33k_fitonpage_resize']}";
    var fitonpage_fluid = "{$mybb->settings['g33k_fitonpage_fluid']}";
    var fitonpage_topbar_resized = "{$lang->fitonpage_topbar_resized}";
    var fitonpage_topbar_full = "{$lang->fitonpage_topbar_full}";
    var fitonpage_topbar_text_class = "{$mybb->settings['g33k_fitonpage_topbar_text_class']}";
    var fitonpage_topbar_bground = "{$mybb->settings['g33k_fitonpage_topbar_bground']}";
    var fitonpage_topbar_icon = "{$mybb->settings['g33k_fitonpage_topbar_icon']}";
    var fitonpage_location = "portal";
-->
</script>
</head>
<body>
{$header}
{$ps_header_portal}
<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0" align="center">
<tr><td valign="top" width="200">
{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
</td>
<td>&nbsp;</td>
<td valign="top">
{$announcements}
</td>
</tr>
</table>
{$ps_footer_portal}
{$footer}
</body>
</html>

{$latestthreads}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->latest_threads}</strong></td>
</tr>
{$threadlist}
</table>
<br />

Można to jakoś zrobić?
Jeśli Ci pomogłem naciśnij guzik POMÓGŁ lub dodaj PUNKT REPUTACJI
Hmmm... Raczej za pomocą tych zmiennych nic nie zdziałasz. Nie wiem, czy recent topic index page 1.0.2 tworzy sobie szablony w globalnych, czy szablon jest pobierany z plugina, ale powinieneś mieć możliwość jego edycji. Jedynym wyjściem jest przepisanie tegoż oto szablonu, by miał taką samą strukturę jak ten z portalu.
Niestety, system szablonów w MyBB zostawia wiele do życzenia. Miejmy nadzieję, że ten, który wprowadzą w wersji 2.0 będzie elastyczniejszy :)
:: Akcja DZIĘKUJĘ ZA POMOC ::
Pomocy udzielam jedynie na forum. Wszystkie rzeczy wykraczające poza tą dziedzinę wykonuję odpłatnie.
Nie tworzy nic w globalnych szablonach. W niezgrupowanych też nic nie ma.
Jeśli Ci pomogłem naciśnij guzik POMÓGŁ lub dodaj PUNKT REPUTACJI
Recent topic index page trzyma szablon tego boxa w pliku pluginu. Można go bezproblemowo edytować.
Tak wygląda plugin:
<?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'], 0, 50);
        $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>)
        </td>
        <td class="trow1">' .
        $postdate . ' ' . $posttime . '
        </td>
        </tr>';
    }


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



}


?>

Pomożesz?
Jeśli Ci pomogłem naciśnij guzik POMÓGŁ lub dodaj PUNKT REPUTACJI
Nie wiem co jaki wygląd chcesz uzyskać, tutaj masz kod odpowiadający za wygląd
$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>';
i
$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>)
        </td>
        <td class="trow1">' .
        $postdate . ' ' . $posttime . '
        </td>
        </tr>';
Wygląd taki jak na /portal.php
Co mam z czym zamienić (co, gdzie wkleić)?
Chodzi po prostu o podmianę kodu z /portal.php do tego pluginu i tyle. :)
Jeśli Ci pomogłem naciśnij guzik POMÓGŁ lub dodaj PUNKT REPUTACJI
Poprawka do kodów, które podał Matslom:

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


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


To będzie chyba mniej więcej wyglądać, jak na portalu.

@edit
Aj, zrobiłem małego babola w drugim kodzie. Poprawiłem już to, więc też go w razie czego zmodyfikuj.
:: Akcja DZIĘKUJĘ ZA POMOC ::
Pomocy udzielam jedynie na forum. Wszystkie rzeczy wykraczające poza tą dziedzinę wykonuję odpłatnie.
Parse error: syntax error, unexpected ')' in /virtual/insidery.cba.pl/inc/plugins/recenttopicsindex.php on line 105
po wejściu w pluginy :(

$recenttopics .= '<td class="trow1">
        <a href="showthread.php?tid=' . $threadRow['tid'] . '&action=lastpost"><strong>' . $subject .'</strong></a><br /> <span class="smalltext">' . $threadRow['lastposter']) . ' <a href="forumdisplay.php?fid=' . $threadRow['fid'] . '">' . $threadRow['name'] . '</a>'  . $lang->recenttopics_by . (!empty($threadRow['lastposteruid']) ? ' <a href="member.php?action=profile&uid=' . $threadRow['lastposteruid'] . '">' . $threadRow['lastposter'] . '</a></span></br>
        <span class="smalltext">' . $postdate . ' ' . $posttime . '</span>
        </td>
        </tr>';
a za tym jest
</thead>';
nie wiem czy te '; ma znaczenie.

Oczywiście podmieniłem te dwa kody w dwóch miejscach, bo chyba o to chodziło.
Jeśli Ci pomogłem naciśnij guzik POMÓGŁ lub dodaj PUNKT REPUTACJI
Teraz chyba powinno być ok:
<?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">
<tr>
<td class="thead" colspan="2">

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

    // 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'], 0, 50);
        $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'] . '"><strong>' . $subject .'</strong></a><br /> <span class="smalltext"><a href="showthread.php?tid=' . $threadRow['tid'] . '&action=lastpost">Ostatni post:</a> <a href="member.php?action=profile&uid=' . $threadRow['lastposteruid'] . '">' . $threadRow['lastposter'] . '</a></span>
        <br /><span class="smalltext">' .
        $postdate . ' ' . $posttime . '
        </span></td>
        </tr>';
    }


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



}


?>
:: Akcja DZIĘKUJĘ ZA POMOC ::
Pomocy udzielam jedynie na forum. Wszystkie rzeczy wykraczające poza tą dziedzinę wykonuję odpłatnie.



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

1 gości