TinyPortal

Development => Support => Topic started by: knat on September 14, 2006, 07:57:57 AM

Title: ? can i make my recent topics code NOT show from chooseable boards ?
Post by: knat on September 14, 2006, 07:57:57 AM
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 ??  ::)
Title: Re: ? can i make my recent topics code NOT show from chooseable boards ?
Post by: akulion on September 14, 2006, 10:32:00 AM
Please refer to these 2 threads for details


recent Topics from board x,y,z (http://www.tinyportal.net/smf/index.php?topic=1234.0)

In the news block (http://www.tinyportal.net/smf/index.php?topic=7596.0)
Title: Re: ? can i make my recent topics code NOT show from chooseable boards ?
Post by: jacortina on September 14, 2006, 04:30:00 PM
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');
Title: Re: ? can i make my recent topics code NOT show from chooseable boards ?
Post by: IchBin on September 14, 2006, 06:55:25 PM
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.
Title: Re: ? can i make my recent topics code NOT show from chooseable boards ?
Post by: jacortina on September 14, 2006, 07:01:18 PM
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.
Title: Re: ? can i make my recent topics code NOT show from chooseable boards ?
Post by: knat on September 16, 2006, 02:41:02 PM
i found out how to do it, thanks for the replies  ::)