Recent Topics on index page : MOD : How-to / Guide

Started by xcooling, June 07, 2006, 05:44:18 AM

Previous topic - Next topic

xcooling

This will add a Recent Topics Bar to your infocenter, on the mainpage. (displays recent topics)

It will be formatted and look exactly the same as the Recent Posts Bar.

To see it live: http://forums.AmericasArmy.co.za

Works with SMF 1.1 (rc1 and RC2)

Open: Themes/<your theme>
(eg: /Themes/default)

Find: // This is the "Recent Posts" bar.

Add the following code, ABOVE !!!!


/****RECENT TOPICS****/

require_once("SSI.php");

  // This is the "Recent Topics" bar.
  if (!empty($settings['number_recent_posts']))
  {
    echo '
        <tr>
          <td class="titlebg" colspan="2">Recent Topics</td>
        </tr>
        <tr>
          <td class="windowbg" width="20" valign="middle" align="center">
            <a href="', $scripturl, '?action=recent"><img src="', $settings['images_url'], '/post/xx.gif" alt="', $txt[214], '" /></a>
          </td>
          <td class="windowbg2">';

    // Only show one post.
    if ($settings['number_recent_posts'] == 1)
    {
    }
    // Show lots of posts.
    elseif (!empty($context['latest_posts']))
    {
      echo '
            <table cellpadding="0" cellspacing="0" width="100%" border="0">';

      /*
          Each post in latest_posts has:
          board (with an id, name, and link.), topic (the topic's id.),
          poster (with id, name, and link.),
          subject, short_subject (shortened with...), time, link, and href.
      */
/*
$posts = ssi_recentTopics(8, null, 'return');
foreach ($posts as $post)
{
  echo 'Post: <a href="', $post['href'], '">', $post['subject'], '</a><br>
Description: ', $post['short_subject'], '<br>';
}
*/
     
      $posts = ssi_recentTopics($settings['number_recent_posts'], null, 'return');   
      foreach ($posts as $post)
        echo '
              <tr>
                <td class="middletext" valign="top" nowrap="nowrap">
                <b>',
                $post['link'],
                '</b> ',
                $txt[525],
                ' ',
                $post['poster']['link'],
                ' (',
                $post['board']['link'],
                ')
                </td>
                <td class="middletext" align="right" valign="top" nowrap="nowrap">',
                $post['time'],
                '</td>
              </tr>';
      echo '
            </table>';
    }
    echo '
          </td>
        </tr>';
  }
 
  /***RECENT TOPICS***/

psi0

Thanks!

Just one thing, where i change "Recent Topics" for other language?

trigger39

how can i stop it displaying topics from the private area and display public ones only?

Minare

Have you got codes for smf 1.0.8 or smf 1.0.9 ?

I need them to show recent topics on index  :(

justafishermen

I installed this on 1.1 RC3 and it works great however now there is "Recent Posts" and also "Recent Topics" on the main page and BOTH are showing Recent Topics.

How do I remove the "Recent Posts" one and keep the Topics one?

Thanks!
Angling Fanatics Fishing Community
Built By The Members For The Members

Advertisement: