collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 428
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: 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
  • {OCS}MasterSeal: 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
  • {OCS}MasterSeal: 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

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Scrolling Recent Topics  (Read 13044 times)

0 Members and 1 Guest 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 DeveloperMy 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 DeveloperMy 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: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
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: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
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

  • Comrade
  • *
  • Posts: 4870
  • 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?