Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

December 05, 2022, 11:31:22 PM

Login with username, password and session length
Members
  • Total Members: 3853
  • Latest: tty456
Stats
  • Total Posts: 193627
  • Total Topics: 21108
  • Online today: 83
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 0
Guests: 59
Total: 59

Author Topic: Block code for recent topics  (Read 7585 times)

0 Members and 1 Guest are viewing this topic.

Offline agent47

  • Full Member
  • ***
  • Posts: 103
Block code for recent topics
« on: October 13, 2012, 12:10:07 PM »
Link to my site: http://www.superheroalliance.net
SMF version: SMF 2.0.2
TP version: TP 1.0
Default Forum Language: English utf8
Theme name and version: DzinerStudio's laGusta

Guys, I'm looking for a simple block code that displays recent topics in the following manner:

[screen removed]
It's nice and clean just the way I like it.

Thanks in advance.

Kind regards,
agent47
« Last Edit: October 14, 2012, 04:12:49 AM by agent47 »

Offline lurkalot

  • Administrator
  • *
  • Posts: 7415
    • Camera Craniums
Re: Block code for recent topics
« Reply #1 on: October 13, 2012, 05:01:10 PM »
This one kind of does what you need.  I'm sure it could be tweaked if necessary.  Put it in a php block.  ;)

Code: [Select]
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('8', 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>';

Offline agent47

  • Full Member
  • ***
  • Posts: 103
Re: Block code for recent topics
« Reply #2 on: October 13, 2012, 06:12:17 PM »
Hey lurkalot ol' pal, have I ever told you how awesome you are? Because if I haven't here's me saying it "You're too damn awesome bud!!!!"  O0
Thanks pal.

Offline lurkalot

  • Administrator
  • *
  • Posts: 7415
    • Camera Craniums
Re: Block code for recent topics
« Reply #3 on: October 14, 2012, 01:45:30 AM »
Thanks agent47.   I can't take credit for this one, I grabbed the code from this thread http://www.tinyportal.net/index.php?topic=596.0 

Which I found in the old snippets boards, which you can find here.  http://www.tinyportal.net/index.php?topic=4983.0  These are for old versions of TP / SMF, but some still work. ;)

Offline MrCare

  • Jr. Member
  • **
  • Posts: 62
Re: Block code for recent topics
« Reply #4 on: August 14, 2013, 12:08:36 AM »
This one kind of does what you need.  I'm sure it could be tweaked if necessary.  Put it in a php block.  ;)

Code: [Select]
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('8', 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>';
how can we make it  like default board index display? like we have in forum?