dopetalk

Technology => SMF Forum Code Modifications => Topic started by: Chip on September 13, 2016, 07:38:33 AM

Title: Simple Portal "Recent Topics" php Block
Post by: Chip on September 13, 2016, 07:38:33 AM
http://simpleportal.net/index.php?topic=3567.msg22678#msg22678

"Recent Topics" php Block:

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

$boards = null;
$limit = 5;
$type = 'ssi_recentTopics';

$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 '
<table class="sp_fullwidth">';

foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
', $item['new'] ? sp_embed_image('topic') : '<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>',
'</td>
<td class="sp_recent_subject">
<a href="', $item['href'], '">', $item['subject'], '</a><br />[', $item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
</tr>';

echo '
</table>';
SimplePortal 2.3.6 © 2008-2014, SimplePortal