collapse

* User Info

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

* Who's Online

  • Dot Guests: 243
  • 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]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: [Block] Scrolling/Scrollbar recent topics  (Read 9381 times)

0 Members and 8 Guests are viewing this topic.

Offline thepitster

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ALLRiPPED
  • SMF Version: 2.0.14
  • SP Version: 2.3.7
[Block] Scrolling/Scrollbar recent topics
« on: September 05, 2017, 04:14:10 PM »
With the help of [SiNaN] on a another post that is now gone, this is what I ended up going with for the recent topic scroller block in case someone else might find it useful:
Code: (PHP) [Select]
global $txt, $scripturl, $settings, $context, $color_profile;

$boards = array(37, 38); // all the board ids to exclude
$limit = 20;
$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="300px" scrolldelay=" 10" scrollamount="3" 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>';
you can format it like this:

	
$boards = array(91011131516171819222324262728313435); // all the board ids to include


or you can also limit the number of boards that show recent topics, just remember to separate your boards IDs with a comma (,) by editing like so:

	
$boards = array(3738); // all the board ids to include



also if you wanted the information being displayed by the block to be a little more "compact"  you can change this:

	
$display 'full'// Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.


to this:

	
$display 'compact'// Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.


now if I wanted to change it up abit and just use a scrollbar with no upwards marquee, you could use this
Code: (PHP) [Select]
global $txt, $scripturl, $settings, $context, $color_profile;

$boards = array(9, 10, 11, 13, 15, 16, 17, 18, 19, 22, 23, 24, 26, 27, 28, 31, 34, 35); // all the board ids to include
$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:220px">';

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>';
or if I wanna shrink it and have it go right to left and use it as a header or footer I could use this
Code: (PHP) [Select]
global $txt, $scripturl, $settings, $context, $color_profile;

$boards = array(37, 38); // all the board ids to include
$limit = 20;
$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="left" height="80px" scrolldelay=" 10" scrollamount="3" 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>';

all of this can be used in the Custom PHP block in the block manager of Simpleportal.
And again this was all possible thanks to the help of [SiNaN] right here at simpleportal.net, he deserves mostly all the credit for helping this novice figure it all out.
« Last Edit: September 05, 2017, 06:57:29 PM by ♦ Ninja ZX-10RR ♦ »
Proud User and Supporter of SimplePortal v2.3.7

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1161
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Scrolling/Scrollbar recent topics
« Reply #1 on: September 05, 2017, 06:58:35 PM »
Thanks a LOT for coming back to post this one, otherwise it would have been lost. I changed your title a little and moved it to the proper blocks board and added it to the index :)
(Mostly because yes it did fit Custom Coding but being an useful block perhaps others want to download it, so they may be going to the blocks board to look for it).
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis

Offline thepitster

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ALLRiPPED
  • SMF Version: 2.0.14
  • SP Version: 2.3.7
Re: [Block] Scrolling/Scrollbar recent topics
« Reply #2 on: September 06, 2017, 03:27:11 AM »
Well thanks for the promo and support on this, it is greatly appreciated.
I've also still got another sniplet similar the ones above, but uses ssi_recentCreatedTopics (another lost [SiNaN] SSI.php modification for a block that I am currently using) and some differently arranged code I can edit my above topic with it, but since it requires "editing/adding to" the SSI.php, should it be posted as block or mod, or both?
« Last Edit: September 06, 2017, 03:30:29 AM by thepitster »
Proud User and Supporter of SimplePortal v2.3.7

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1161
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Scrolling/Scrollbar recent topics
« Reply #3 on: September 06, 2017, 09:12:59 AM »
I don't know until I see it ;D Post it in custom coding, if it fits here better I'll move it, don't worry :) It's already pretty great you're taking the time to come back and post these things, most people wouldn't do it.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis

Offline thepitster

  • Semi Newbie
  • *
  • Posts: 8
  • Gender: Male
    • ALLRiPPED
  • SMF Version: 2.0.14
  • SP Version: 2.3.7
Re: [Block] Scrolling/Scrollbar recent topics
« Reply #4 on: September 06, 2017, 11:30:04 AM »
no problem, I found these of great use and would think others would/could too and it "would" be a shame if it was not shared for all to see, enjoy, and use.
Proud User and Supporter of SimplePortal v2.3.7