collapse

* User Info

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

* Who's Online

  • Dot Guests: 238
  • Dot Hidden: 0
  • Dot Users: 2
  • Dot Users Online:

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • [DFg]DJF-1975: Thanks again for this awesome place!
    September 05, 2017, 07:12:24 PM
  • ♦ Ninja ZX-10RR ♦: An announcement will come soon™ about this issue. Sorry for the inconvenience.
    September 04, 2017, 04:32:08 PM
  • Black Tiger: Site is back but with an old backup it seems.
    September 04, 2017, 10:04:29 AM
  • aegersz: YAY ! the site is back. I was getting so worried.
    September 02, 2017, 11:55:42 PM
  • [DFg]DJF-1975: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • [DFg]DJF-1975: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • [DFg]DJF-1975: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM
  • phantomm: and from what I see only patch is broken, full install package is fine
    October 21, 2016, 03:44:44 PM
  • phantomm: they say it for over 3 weeks now..
    October 21, 2016, 03:43:52 PM

* Recent Posts

Re: Regarding the Recent Downtime by thepitster
[September 18, 2017, 11:40:51 PM]


Re: Posts deleted / dissapeared? by ♦ Ninja ZX-10RR ♦
[September 16, 2017, 06:25:39 PM]


Re: Regarding the Recent Downtime by kim
[September 15, 2017, 04:22:30 PM]


Regarding the Recent Downtime by Eliana Tamerin
[September 15, 2017, 05:24:58 AM]


Re: [Block] Scrolling/Scrollbar recent topics by thepitster
[September 06, 2017, 11:30:04 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Scrolling Recent Topics  (Read 7259 times)

0 Members and 2 Guests are viewing this topic.

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Scrolling Recent Topics
« on: August 27, 2009, 10:08:11 PM »
Hi guys.
First off.. let me say thanks for a great portal.
I have tried a couple of different portals (am very very new to SMF) and I must say that SimplePortal is true to it's name.
Simple to install and Simple to understand how to work it.  :)

Now.. I am looking at converting my live forum over to SMF. I have already done a test conversion and most things seem to be working great (got to learn the SMF permissions system a bit better yet).
One of the most popular features of my current site setup is a scrolling Recent Posts block.
Is this something that is possible with SimplePortal??

You can see the scroller here: www.ozsportsbikes.com

And my test conversion / install can be seen here: www.ozsuperbikes.com

Thanks in advance for the help guys :)

Offline tattooedpierre

  • Semi Newbie
  • *
  • Posts: 9
Re: Scrolling Recent Topics
« Reply #1 on: September 26, 2009, 04:33:41 AM »
I know this is an old thread now, but I really want this scrolling recents block too. I had it within TinyPortal:

Code: [Select]
// TPortal recent topics block
function TPortal_recentbox()
{
global $context, $settings, $options, $txt , $modSettings;

    // is it a number?
if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='10';

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

$what=ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'], $bb, $output_method = 'array');
// Output the topics
$counter=1; $cmax=count($what);
echo '
<div style="width: 100%; ' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';


echo '<marquee  behavior="scroll" direction="up" height="170px" scrolldelay=" 10" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';

foreach($what as $w){
echo '
<div class="smalltext">
<a href="'.$w['href'].'">'.$w['short_subject'].'</a>
</div>
<div class="smalltext">', $txt[525], ' <b>', $w['poster']['link'], '</b></div>
<div class="smalltext">';
if(!$w['new'])
echo '<a href="'.$w['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';



if($counter != $cmax)
echo '<hr />';
$counter++;
}
echo '
</marquee></div>';
}

.. but I'm sure this wont work as-is in SP; and I'm just not sure what might need to be changed (though, presumably the TinyPortal references for sure).

Cheers.

Offline MissyNL

  • Jr. Member
  • **
  • Posts: 73
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Scrolling Recent Topics
« Reply #2 on: October 06, 2009, 06:43:07 PM »
i would love to see that to :D

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Scrolling Recent Topics
« Reply #3 on: October 06, 2009, 07:30:19 PM »
This is a good block idea, but I don't think that it will be added to the main SimplePortal package. Although I will consider adding 'scrolling' as an option to the recent block type.

The code block below should work for SP 2.3 + SMF 2, in a custom PHP block.

Code: [Select]
global $txt, $scripturl, $settings, $context, $color_profile;

$boards = null;
$limit = 10;
$type = 'ssi_recentTopics'; // Can also be 'ssi_recentPosts' for recent posts.
$display = 'full'; // Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.

$items = $type($limit, null, $boards, 'array');

if (empty($items))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
else
$items[count($items) - 1]['is_last'] = true;

$colorids = array();
foreach ($items as $item)
$colorids[] = $item['poster']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}

echo '<marquee behavior="scroll" direction="up" height="170px" scrolldelay=" 10" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';

if ($display == 'compact')
{
foreach ($items as $key => $item)
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt['by'], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}
elseif ($display == 'full')
{
echo '
<table class="sp_fullwidth">';

foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
</td>
<td class="sp_recent_subject">
<a href="', $item['href'], '">', $item['subject'], '</a>
', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
</tr>';

echo '
</table>';
}

echo '</marquee>';
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #4 on: October 06, 2009, 07:47:49 PM »
Works a treat!! Thanks heaps Nathaniel :D
http://www.oztowtrucks.com/index.php

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #5 on: October 06, 2009, 08:07:07 PM »
Another little feature for it would be the ability to manipulate the scroll direction with the mouse.
Take a look at my live site  www.ozsportsbikes.com

If you move the mouse over the scroller, you can make it go up or down.. and speed it up
(works crap in IE8 unless you use compatibility mode ;) )

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Scrolling Recent Topics
« Reply #6 on: October 06, 2009, 09:15:24 PM »
That block uses Javascript, which involves a bit more work. ;)

For now, the marquee solution (as the TP block does it) will have to do, I'll try and come back and look at this block when I have some more time though.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Offline MissyNL

  • Jr. Member
  • **
  • Posts: 73
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Scrolling Recent Topics
« Reply #7 on: October 13, 2009, 04:37:32 PM »
thanks nathaniel for the code :D

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #8 on: December 28, 2009, 08:48:35 AM »
That block uses Javascript, which involves a bit more work. ;)

For now, the marquee solution (as the TP block does it) will have to do, I'll try and come back and look at this block when I have some more time though.


Just bumping this.. to see if you have had any time  :D :D :D

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #9 on: December 29, 2009, 08:29:45 AM »
Nathaniel (or anyone else with the ability)...
I would really like a recent topics block that has the features similar to my existing phpbb3 site (link mentioned in my post above)
I would be more than happy to have this done on commission.. if anyone is keen to make a few $$ from it :)

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #10 on: January 14, 2010, 05:21:59 AM »
Nathaniel (or anyone else with the ability)...
I would really like a recent topics block that has the features similar to my existing phpbb3 site (link mentioned in my post above)
I would be more than happy to have this done on commission.. if anyone is keen to make a few $$ from it :)
Bump.. anyone capable??keen to earn some funds??

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 72
  • Gender: Male
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Scrolling Recent Topics
« Reply #11 on: January 31, 2010, 09:39:02 PM »
How can I use this code without the marquee?  I'd like to slightly modify it to be about 300px tall and no scrolling behavior, but have a scroll bar.  I intend to show about 20 recent posts but have the box render only 250 or 300px high to save space.  Users can drag a scroll bar to see them all.

Thank you in advance!

Offline sattninja

  • Semi Newbie
  • *
  • Posts: 27
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Scrolling Recent Topics
« Reply #12 on: March 17, 2010, 10:19:37 PM »
this is great thanks

is there a way to adjust how many topics are displayed 

thanks

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6785
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Scrolling Recent Topics
« Reply #13 on: March 18, 2010, 09:32:10 AM »
How can I use this code without the marquee?  I'd like to slightly modify it to be about 300px tall and no scrolling behavior, but have a scroll bar.  I intend to show about 20 recent posts but have the box render only 250 or 300px high to save space.  Users can drag a scroll bar to see them all.

Thank you in advance!

Try adding max-heigth: 250px; to Custom Body Style of the block. You'll see that on edit > Style Options.

this is great thanks

is there a way to adjust how many topics are displayed 

thanks

Admin > SimplePortal > Blocks. Edit the recent topics block and you'll see the option.
And slowly, you come to realize... It's all as it should be...

Offline sattninja

  • Semi Newbie
  • *
  • Posts: 27
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Scrolling Recent Topics
« Reply #14 on: March 18, 2010, 10:20:07 AM »
i am confused i made a custom php block for this and there is no option i m sure you would need to edit the code as it doesn't know that it is a recent post block

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6785
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Scrolling Recent Topics
« Reply #15 on: March 18, 2010, 10:59:13 AM »
Ah, sorry. For you, you need to edit this part in the code:

Code: [Select]
$limit = 10;
Change 10 as you like.
And slowly, you come to realize... It's all as it should be...

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 72
  • Gender: Male
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Scrolling Recent Topics
« Reply #16 on: March 23, 2010, 03:09:42 AM »
Thanks Sinan.  Here is the code I ended up using a while back.  I thought I would share.  This scrolls the last 20 posts (not auto scroll).

PHP BLOCK:

Code: [Select]
global $txt, $scripturl, $settings, $context, $color_profile;

$boards = null;
$limit = 20;
$type = 'ssi_recentTopics'; // Can also be 'ssi_recentPosts' for recent posts.
$display = 'compact'; // Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.

$items = $type($limit, null, $boards, 'array');

if (empty($items))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
else
$items[count($items) - 1]['is_last'] = true;

$colorids = array();
foreach ($items as $item)
$colorids[] = $item['poster']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}

echo '<div style="overflow:auto; height:320px; width:190px">';

if ($display == 'compact')
{
foreach ($items as $key => $item)
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt['by'], ' ', $item

['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' .

$settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}
elseif ($display == 'full')
{
echo '
<table class="sp_fullwidth">';

foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
</td>
<td class="sp_recent_subject">
<a href="', $item['href'], '">', $item['subject'], '</a>
', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' .

$item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br

/>[', $item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
</tr>';

echo '
</table>';
}

echo '</div>';


Demo: www.StangNation.com

Offline mhbell

  • Newbie
  • Posts: 2
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #17 on: April 17, 2010, 02:35:29 PM »
This is a good block idea, but I don't think that it will be added to the main SimplePortal package. Although I will consider adding 'scrolling' as an option to the recent block type.

The code block below should work for SP 2.3 + SMF 2, in a custom PHP block.

Thank you very Much I tried this and it is working for me I am very greatful
M H Bell

Offline roomeat

  • Jr. Member
  • **
  • Posts: 51
    • Ozsportsbikes
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #18 on: May 04, 2010, 02:53:53 PM »
Can anyone tell me how to modify this block to EXCLUDE 2 boards??

Offline AngelinaBelle

  • Support
  • *
  • Posts: 4871
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Scrolling Recent Topics
« Reply #19 on: May 04, 2010, 08:17:00 PM »
This block calls the function ssi_RecentTopics.
Code: [Select]
$type = 'ssi_recentTopics';
...
$items = $type($limit, null, $boards, 'array');
So have a look in the file SSI.php to see how to choose which boards to use.
Code: (SSI.php) [Select]
function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo')
...
if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
  $exclude_boards = array($modSettings['recycle_board']);
 else
  $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
So it seems the easiest way to exclude the two boards is to put the board numbers in an array, and pass them to the function.
 
That means you need to make only a slight change to the block
Code: (find) [Select]
   $boards = null;
   $limit = 20;
   $type = 'ssi_recentTopics'; // Can also be 'ssi_recentPosts' for recent posts.
   $display = 'compact'; // Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.

   $items = $type($limit, null, $boards, 'array');
Code: (replace) [Select]
   $exclude_boards=array(1, 2); // all the board ids to exclude
   $boards = null;
   $limit = 20;
   $type = 'ssi_recentTopics'; // Can also be 'ssi_recentPosts' for recent posts.
   $display = 'compact'; // Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.

   $items = $type($limit, $exclude_boards, $boards, 'array');

 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?