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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 302
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 248
  • Total: 248

Compact recent topics view

Started by Greybrow, September 06, 2006, 06:08:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Greybrow

Just put this inside new php block, and use no matter the server and theme:
// Compact recent topics view
// Based on TinyPortal default block by BLOC
// Author: Greybrow
// Version: 2007-02-05 14:30
// Features:
// compact, uses smf icons for read/unread post,
// shows long topic, author, posting date on hover

// number of displayed topics
$last_topics_count='20';

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb=array($modSettings['recycle_board']);
else
$bb=array();

// get topics from SSI
$what=ssi_recentTopics($num_recent = $last_topics_count, $bb, $output_method = 'array');

// Output the topics
echo '<div style="width: 100%; overflow: hidden;">';
foreach($what as $w)
{
echo '<div style="white-space: nowrap;" class="smalltext">';
echo $w['new'] ? '<img src="' . $settings['images_url'] . '/new_none.gif" alt="+" border="0" style="vertical-align: middle;" />' : '<img src="' . $settings['images_url'] . '/new_some.gif" alt="-" border="0" style="vertical-align: middle;" />';
echo '<a href="'.$w['href'].'" title="'.$w['subject'];
echo "\n";
echo $w['poster']['name'];
echo "\n";
echo $w['time'];
echo '">';
echo strlen(un_htmlspecialchars($w['short_subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($w['short_subject']), 0, 22) . '...') : $w['short_subject'];
echo '</a></div>';
}
echo '</div>';

edit: 2006-01-30, removed unused variable, which was showing up as error in reports.
edit: 2006-02-05 4am, if the block makes strange gaps between columns ...cut
edit: 2006-02-05 2pm, I've changed the code, so you don't have to play with it by yourself, and I've fixed new-post icon vertical position
If you wish to use ie not friendly code:
change line:

echo strlen(un_htmlspecialchars($w['short_subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($w['short_subject']), 0, 22) . '...') : $w['short_subject'];

to:
echo $w['short_subject'];

IchBin

Would be great if you could share a demo link or a screenshot for those that might want to try it. Thanks for sharing!

Greybrow

Screenshots added.
Sorry, but in Polish only :)

IchBin


Greybrow

A bit of update. Some errors fixed.

Tanix


knat


houston

Great Mod, I like the design but it creates quite a large gap between my right side blocks column and my center blocks.

Greybrow

I suppose you use IE. There is some strange problem with this browser not supporting "overflow: hidden;" in styles.
Try this. Instead of:
echo '">'.$w['short_subject'].'</a></div>';
put
echo strlen(un_htmlspecialchars($w['short_subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($w['short_subject']), 0, 22) . '...') : $w['short_subject'];

It will trim longer subjects to 25 letters.

knat

i had same problem and try to use your fix for it but that makes the block go totaly nuts pushing the other blocks off the screen  :o

any other way to fix the problem with IE7 ?

This website is proudly hosted on Crocweb Cloud Website Hosting.