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

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 05:48:54 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 153
  • Total: 153

Scrolling Recent Posts

Started by tattooedpierre, November 12, 2005, 11:01:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tattooedpierre

Ok, I grabbed this code block from the official SMF forums:


// Show lots of posts.
if (!empty($context['latest_posts']))
{
echo '<marqueeÂÃ,  behavior="scroll" direction="up" height="50" scrolldelay="300" scrollamount="2">
<table 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. */
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">[', $post['board']['link'], ']</td>
<td valign="top">', $post['link'], ' ', $txt[525], ' ', $post['poster']['link'], '</td>
<td align="right" valign="top" nowrap="nowrap">', $post['time'], '</td>
</tr>';
echo '
</table></marquee>';
}


.. now normally this would go in your index.template.php below template_menu(); .. A better way I had hoped would be to add this as a PHP block.. but when I do this I get a blank area (either as a block or in index.template.php). No errors, just no recent posts either :S .. can anyone help?

Here's the original offical SMF board link http://www.simplemachines.org/community/index.php?topic=13985.0

EDIT: To clarify, the purpose is to allow my recent posts to scroll, allowing me to show more than say 5 at a time; whilst maintaining the block size.

bloc

Thats a bit of code that assume its variable being pre-filled in BoardIndex.php - where it fetch and call another routine from Recent.php.

So no, it won't display anything  - unless its placed in BoardIndex.template which its normally located (not in index.template.php).

tattooedpierre

Excellent Bloc, cheers.. ok. so in TP it now shows the recent posts which is excellent.. but they're not moving! Any ideas?

bloc

Hm..some javascript code to make it move within a div perhaps...I am not sure what exists of such though.

tattooedpierre

Quote from: Bloc on November 13, 2005, 10:26:13 AM
Hm..some javascript code to make it move within a div perhaps...I am not sure what exists of such though.

Ah I see.. not to worry then ;)

Nokonium

The display of recent shouts scrolls, could that code be transplanted?

tattooedpierre

Quote from: nokonium on November 13, 2005, 10:51:40 AM
The display of recent shouts scrolls, could that code be transplanted?

It does?! Mines doenst :(

Nokonium

Not automatically, but it has a scrollbar. Though you can get a scrolling shout box

http://www.totaltwaddle.co.uk/board/

This is based on the Classic theme, but it is SMF

snork13

#8
well, i don't know how bloc feels about messing with his code...but i get it to scroll without a problem...$Themes/TPortalBlocks.template

change this:

// TPortal shoutbox
function TPortal_shoutbox()
{
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  global $context, $settings, $options, $scripturl, $txt, $modSettings;

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  // Show the shoutbox, takes settings from tpadmin
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if(isset($context['TPortal']['querystring']))
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, $tp_where=$context['TPortal']['querystring'];
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, else
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $tp_where='';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if(!isset($context['TPortal']['shoutbox']))
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, $context['TPortal']['shoutbox']='';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo ' <table style="table-layout: fixed;" cellpadding="0" height="'.$context['TPortal']['shoutbox_height'].'" cellspacing="0" border="0" width="100%"><tr><td class="smalltext"><div style="height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto; width: 100%;">', $context['TPortal']['shoutbox'], '
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, </div></td></tr></table><form style="margin-top: 8px; text-align: center;" class="smalltext" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod&id=shout" method="post">
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, ';
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<textarea class="smalltext" name="tp-shout" style="width: 80%; height: 50px;" type="text"></textarea><br /><input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<br /><input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, else
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<input name="tp-shout-url" type="hidden" value="'.$tp_where.'">
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, </form>';
}



to this:

// TPortal shoutbox
function TPortal_shoutbox()
{
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  global $context, $settings, $options, $scripturl, $txt, $modSettings;

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  // Show the shoutbox, takes settings from tpadmin
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if(isset($context['TPortal']['querystring']))
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, $tp_where=$context['TPortal']['querystring'];
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, else
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $tp_where='';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if(!isset($context['TPortal']['shoutbox']))
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, $context['TPortal']['shoutbox']='';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo ' <marqueeÂÃ,  behavior="scroll" direction="up" height="100" scrolldelay="300" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()"><table style="table-layout: fixed;" cellpadding="0" height="'.$context['TPortal']['shoutbox_height'].'" cellspacing="0" border="0" width="100%"><tr><td class="smalltext"><div style="height: '.$context['TPortal']['shoutbox_height'].'px; width: 100%;">', $context['TPortal']['shoutbox'], '
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, </div></td></tr></table></marquee><form style="margin-top: 8px; text-align: center;" class="smalltext" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod&id=shout" method="post">
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, ';
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<textarea class="smalltext" name="tp-shout" style="width: 80%; height: 50px;" type="text"></textarea><br /><input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<br /><input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, else
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">';

ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, echo '<input name="tp-shout-url" type="hidden" value="'.$tp_where.'">
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, </form>';
}


hopeÂÃ,  this is ok and helps

ps <marquee> is sloppy fix ;)

tattooedpierre

#9
I dont appear to have the TPortalBlocks.template file in my black22 directory (which is my default theme) .. should this be there? It is in my netpune theme folder though?

EDIT: I just added into Neptune to see if it works, and it does. So if this could be modified for recent posts, this would be most excellent!