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

Recent

Welcome to TinyPortal. Please login or sign up.

May 19, 2024, 12:07:04 AM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 70
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 67
  • Total: 67

"recent topics" in SMF style

Started by Lesmond, August 17, 2005, 12:01:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cygy2k

Thank you bloc.  I knew it was an easy question for you pros.  Thanks for the great product and support!!

RoarinRow

How hard would it be to add a 'Replies' and 'Views' column in-between 'Poster' and 'Time'

Replies would be just the number of replies to that thread vs. how many views up to that point?

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Sakuragi

Quote from: akulion on May 01, 2006, 09:57:26 AM
i was wondering is it possible to have a modification of this code so that it does the following?

1 - Only displays topics from a particular board
Quote from: Bloc on May 01, 2006, 03:01:41 PM
akulion: for just one baord is easy

any other way to do this instead using array('3','56') cause i have more than 80 boards and it makes my site buggy

jpark

Quote from: Bloc on May 01, 2006, 06:34:27 PM
I see. So just sorting on created dates then, not on last replied date. That would mean even a simpler sql call.

I don't know if Akulion got an answer to this but I would like to know how to do this as well.. sorry to bump and thanks in advance!  ;D

RoarinRow

Quote from: RoarinRow on May 12, 2006, 03:46:35 PM
How hard would it be to add a 'Replies' and 'Views' column in-between 'Poster' and 'Time'

Replies would be just the number of replies to that thread vs. how many views up to that point?

Bump.  Still seeing if someone could please add the code to add 'Replies' and 'Views' column just like SMF.  See attached.  It helps our power posters.   :)

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

bloc

Uhm..I can help there, but what "version" are you using? The original have had a few changes by several people in this topic, so I am not sure what you are using now. :)

RoarinRow

Quote from: Bloc on May 19, 2006, 01:41:30 PM
Uhm..I can help there, but what "version" are you using? The original have had a few changes by several people in this topic, so I am not sure what you are using now. :)

This is the version I'm using now

// "Recent Topics" a php Block
// Prefered settings when being designed
// Border and title on
// Title ="Recent Topics"

global $scripturl;
$what=ssi_recentTopics('35', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle">Subject</td><td valign="middle">Board</td><td valign="middle">Poster</td><td valign="middle">Time</td></tr>';

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['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['board']['link'], '</td>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['poster']['link'], '</td><td class="windowbg2" valign="middle" >';
      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>';

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

bloc

uhm, one problem: the SSI function doesn't collect those variables. Need to rewrite that function then.

RoarinRow

Quote from: Bloc on May 19, 2006, 07:33:37 PM
uhm, one problem: the SSI function doesn't collect those variables. Need to rewrite that function then.

Doh!  o.k. thank Bloc   :o  no worries then.  It was a nice to have.

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

RoarinRow

Quote from: RoarinRow on May 19, 2006, 06:37:14 PM
Quote from: Bloc on May 19, 2006, 01:41:30 PM
Uhm..I can help there, but what "version" are you using? The original have had a few changes by several people in this topic, so I am not sure what you are using now. :)

This is the version I'm using now

// "Recent Topics" a php Block
// Prefered settings when being designed
// Border and title on
// Title ="Recent Topics"

global $scripturl;
$what=ssi_recentTopics('35', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle">Subject</td><td valign="middle">Board</td><td valign="middle">Poster</td><td valign="middle">Time</td></tr>';

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['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['board']['link'], '</td>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['poster']['link'], '</td><td class="windowbg2" valign="middle" >';
      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>';


Anyone know why the number of recent topics don't show 35 like I have configured in this section of the code above:

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

Right now it shows 24 posts instead of the 35 I'd like to see.

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0