SimplePortal
Development => Feature Requests => Topic started by: roomeat 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 :)
-
I know this is an old thread now, but I really want this scrolling recents block too. I had it within TinyPortal:
// 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.
-
i would love to see that to :D
-
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.
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>';
-
Works a treat!! Thanks heaps Nathaniel :D
http://www.oztowtrucks.com/index.php
-
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 ;) )
-
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.
-
thanks nathaniel for the code :D
-
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
-
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 :)
-
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??
-
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!
-
this is great thanks
is there a way to adjust how many topics are displayed
thanks
-
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.
-
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
-
Ah, sorry. For you, you need to edit this part in the code:
$limit = 10;
Change 10 as you like.
-
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:
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
-
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
-
Can anyone tell me how to modify this block to EXCLUDE 2 boards??
-
This block calls the function ssi_RecentTopics.
$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.
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
$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');
$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');