TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 515
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 126
  • Total: 127
  • lurkalot

? can i make my recent topics code NOT show from chooseable boards ?

Started by knat, September 14, 2006, 07:57:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knat

i have this recent topics php block on my frontpage

global $scripturl;

echo '
                        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
                               <tr><td colspan="3" class="titlebg">Recent topics</td></tr> ';
       $what=ssi_recentTopics('4', NULL, 'array');


        foreach ($what as $topic)
        {
                echo '
                                <tr>
                                        <td class="windowbg" valign="middle">
                                                ', $topic['link'];

                // Is this topic new? (assuming they are logged in!)
                if (!$topic['new'] && $context['user']['is_logged'])
                        echo '
                                                <a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

                echo '
                                        </td>
                                        <td class="windowbg2" valign="middle" width="20%">
                                                ', $topic['poster']['link'], '
                                        </td>
                                        <td class="windowbg2" valign="middle" width="35%">';
                if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
                        echo '
                                        <a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
                echo '
                                                <span class="smalltext">
                                                        ', $topic['time'], '
                                                </span>
                                        </td>
                                </tr>';
        }

        echo '
                        </table>';


My problem is that i have a board for RSS feeds and i dont want topics from this board to be shown.. is it possible to tell the code dont show topics from this board ID ??  ::)


jacortina

I believe all you have to do is to use the built-in exclude in the ssi_recentTopics function:

$what=ssi_recentTopics('4', NULL, 'array');

That NULL can be an array of boardids to exclude (and should be in an array even if only one board is excluded, I think):


$exclude_boards = array(3,6,9);
$what=ssi_recentTopics('4', $exclude_boards, 'array');

IchBin

I thought the array was to choose which boards to include, not exclude. I wish SMF would give a better description of their SSI features in the examples files.

jacortina

A quick look in SSI.php itself shows that it starts:


function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = 'echo')
{
global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings;

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;


So, I assume that unless an installation's SSI has been modified, that argument would be the list to exclude.

knat


This website is proudly hosted on Crocweb Cloud Website Hosting.