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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 364
  • Total: 365
  • @rjen

"recent topics" in SMF style

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

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

akulion

Yup :D

So what do I need to do? :D:D

nite0859

Quote from: akulion on April 30, 2006, 11:21:35 AM
Quote from: BlueSteel on March 29, 2006, 01:07:56 AM
ok here it is updated and re-organised and re-formatted

It should now only display the headings once


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

global $scripturl;
$what=ssi_recentTopics('10', 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>';





bluesteel THANK YOU SO MUCH I have been dying for this snippet of code for ages!

UR THE BOMB!


Beautiful. Thanks!

cygy2k

So how can you add a scroll bar and fixed height to this?

G6Cad

Read through the thread before asking. All the answers are in this thread for you to read

cygy2k

#94
I read every word of the thread before posting, I always do.  I've seen how to make it so it auto scrolls but not to where you can have a scroll bar.  I have not seen that in any of the threads I found when searching.  I really like the new layout of this design but don't see hot to add a scroll bar.

johanlm

Redid this one a bit layoutwise so it would more look like the TP recent topics block.

Wanted it basicly to look the same, but with the option to hide rooms so I could make severall.
Thank you very much Bloc for the base code. I basiclly just rearranged, removed and added some comments so one would see directly in the code how to hide rooms etc.

global $scripturl; echo '

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor"> ';

// To show more posts change the number at recentTopics('8', to the amount you want.

// To hide specific rooms from the PHPscript replace the """, NULL,""" with """, array('7','56'),""" as an example.
// The numbers at the array = the rooms ID number. To find out what ID number the room you want to hide is, just klick on it.
// Then see what number it is at the end of the url. For example: /index.php?board=7.0 is the same as number 7

//This is the codeline you alter to change the amount of topics to show + hide rooms.
$what=ssi_recentTopics('10', NULL, 'array');

foreach ($what as $topic){echo '

<tr>
<td class="windowbg" valign="middle">

<span class="smalltext">', $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 '
<br>
<span class="smalltext"> ', $topic['time'],'
<br>
Poster: ', $topic['poster']['link'], '
</span>
</span>
</td>
</tr>
';}echo '
</table>
';

cygy2k

G6 or anybody else-

Any ideas on how to make a scroll bar in the new design of this?

G6Cad

#97
Read this

http://www.dyn-web.com/dhtml/scroll/

Or this one for generate costume made with colors and 3d effects

http://www.htmlbasix.com/scrollbargenerator.shtml

cygy2k

Isn't there a way to do it with just setting the height limit of the recent topics and by putting a call for auto wrap or something?  I saw it in a different design for the layout but can't figure out how to make it happen in the new design that is really great by the way.  Sorry for my stupid sounding questions.  I'm new to PHP and really like TP.

bloc

If you put the html code inside a div with some styling like this:

<div style="height: xxpx; overflow: auto;">

..it should show scrollbars when content is larger than set height, at least in Firefox. For IE you might need some tweaking.

This website is proudly hosted on Crocweb Cloud Website Hosting.