Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 19, 2022, 04:55:26 AM

Login with username, password and session length
Members
  • Total Members: 3843
  • Latest: Tricky
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 51
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 1
Guests: 38
Total: 39

Author Topic: Scrolling Recent Posts  (Read 14166 times)

0 Members and 1 Guest are viewing this topic.

tattooedpierre

  • Guest
Scrolling Recent Posts
« on: November 12, 2005, 04:01:44 AM »
Ok, I grabbed this code block from the official SMF forums:

Code: [Select]
// 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.
« Last Edit: November 12, 2005, 04:05:23 AM by tattooedpierre »

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
Re: Scrolling Recent Posts
« Reply #1 on: November 13, 2005, 02:55:19 AM »
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

  • Guest
Re: Scrolling Recent Posts
« Reply #2 on: November 13, 2005, 03:15:42 AM »
Excellent Bloc, cheers.. ok. so in TP it now shows the recent posts which is excellent.. but they're not moving! Any ideas?

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
Re: Scrolling Recent Posts
« Reply #3 on: November 13, 2005, 03:26:13 AM »
Hm..some javascript code to make it move within a div perhaps...I am not sure what exists of such though.

tattooedpierre

  • Guest
Re: Scrolling Recent Posts
« Reply #4 on: November 13, 2005, 03:26:59 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 ;)

Offline Nokonium

  • Aging Hippie
  • Friends
  • *
  • Posts: 1384
    • Our-Local
Re: Scrolling Recent Posts
« Reply #5 on: November 13, 2005, 03:51:40 AM »
The display of recent shouts scrolls, could that code be transplanted?

tattooedpierre

  • Guest
Re: Scrolling Recent Posts
« Reply #6 on: November 13, 2005, 06:18:26 AM »
The display of recent shouts scrolls, could that code be transplanted?

It does?! Mines doenst :(

Offline Nokonium

  • Aging Hippie
  • Friends
  • *
  • Posts: 1384
    • Our-Local
Re: Scrolling Recent Posts
« Reply #7 on: November 13, 2005, 11:19:41 AM »
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

  • Guest
Re: Scrolling Recent Posts
« Reply #8 on: November 13, 2005, 11:33:44 AM »
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:

Code: [Select]
// 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:

Code: [Select]
// 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 ;)
« Last Edit: November 13, 2005, 12:33:07 PM by snork13 »

tattooedpierre

  • Guest
Re: Scrolling Recent Posts
« Reply #9 on: November 13, 2005, 12:44:52 PM »
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!
« Last Edit: November 13, 2005, 12:49:22 PM by tattooedpierre »