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 (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.
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).
Excellent Bloc, cheers.. ok. so in TP it now shows the recent posts which is excellent.. but they're not moving! Any ideas?
Hm..some javascript code to make it move within a div perhaps...I am not sure what exists of such though.
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 ;)
The display of recent shouts scrolls, could that code be transplanted?
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 :(
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
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 ;)
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!
TPortalBlocks.template should be located in the SMF default theme.
I've got scrolling to work flawlessly!!
Here's what to do
REPLACE
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">
';
WITH
echo ' <marquee behavior="scroll" direction="up" height='.$context['TPortal']['shoutbox_height'].'px scrolldelay=" 10" scrollamount=" 1" 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">
';
Oh it's ALMOST the same as snork13's idea but only extra thing is instead of hardcoding 100 has height of shoutbox, it takes it from the Admin panel settings of the shoutbox.
Cool!
Excellent I got this to work great for the shoutbox.. for the recent topics though... ? any ideas?
Mine is running somewhat jerky. Although I do have a few gifs running in the forum as well.
Thanks anyways for the code.
If anyone is interested I found a way to scroll posts Look at THIS TOPIC (http://www.tinyportal.net/index.php?topic=3007.msg25121#msg25121)
that like to scrolling potss isnt valid anymore
Should work now.