News:

Wondering if this will always be free?  See why free is better.

Main Menu

SimplePortal

Started by SimplePortal Team, March 10, 2008, 11:16:07 PM

Previous topic - Next topic

Arantor

The fact that the only 2.1 compatible version of SP that exists is not an official SP "product" would not bode well given that 2.1 is now into year 9 of development.

Mark S

I see. So, changing to Tiny Portal would be prudent?


Xpresskonami

Any method of setting two columns on Simpleportal Boardnews like this

Chen Zhen


Use notepad++ ( not ms notepad ) or another file editor that handles unix line endings properly.

file: ../Sources/PortalBlocks.php
only replace the one function I am including below inside that file.
function to replace: sp_boardNews()

function sp_boardNews($parameters, $id, $return_parameters = false)
{
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;

$width = '49%';

$block_parameters = array(
'board' => 'boards',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$start = !empty($parameters['start']) ? (int) $parameters['start'] : 0;
$length = isset($parameters['length']) ? (int) $parameters['length'] : 250;
$avatars = !empty($parameters['avatar']);
$per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0;
$style = !empty($parameters['style']) ? $parameters['style'] : sportal_parse_style('explode', '', true);

$limit = max(0, $limit);
$start = max(0, $start);

loadLanguage('Stats');

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$request = $smcFunc['db_query']('', '
SELECT t.id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE {query_see_board}
AND ' . (empty($board) ? 't.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
AND (t.locked != {int:locked} OR m.icon != {string:icon})
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5),
'is_approved' => 1,
'locked' => 1,
'icon' => 'moved',
'limit' => $limit,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
elseif (!empty($per_page))
{
$limit = count($posts);
$start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0;

$clean_url = str_replace('%', '%%', preg_replace('~news' . $id . '=[^;]+;?~', '', $_SERVER['REQUEST_URL']));
$current_url = $clean_url . (strpos($clean_url, '?') !== false ? (in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';') : '?');

$page_index = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true);
}

$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar,
a.id_attach, a.attachment_type, a.filename, t.num_views
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}',
array(
'post_list' => $posts,
'start' => $start,
'limit' => !empty($per_page) ? $per_page : $limit,
)
);
$return = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$limited = false;
if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$limited = true;
}
elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);
$limited = true;
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

if ($modSettings['sp_resize_images'])
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);

if (!empty($row['id_member']))
$colorids[$row['id_member']] = $row['id_member'];

$return[] = array(
'id' => $row['id_topic'],
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'views' => $row['num_views'],
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp-read_more'] . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}

$return[count($return) - 1]['is_last'] = true;

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

if ($context['SPortal']['core_compat'])
{
foreach ($return as $news)
{
echo '
<div class="sp_article_content">
<div class="', !empty($style['no_body']) ? '' : ' tborder', '">
<table class="sp_block">';

if (empty($style['no_title']))
{
echo '
<tr>
<td class="sp_middle ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>', $news['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '><a href="', $news['href'], '">', $news['subject'], '</a></td>
</tr>';
}

echo '
<tr>
<td class="sp_block_padding', empty($style['body']['class']) ? '' : ' ' . $style['body']['class'], '"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', ' colspan="2">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" style="float: right;" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '<br /><br /></div>
<div class="sp_right ">', $news['link'], ' ',  $news['new_comment'], '</div>
</td>
</tr>
</table>
</div>
</div>';
}
}
else
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div>
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

if (empty($style['no_title']))
{
echo '
<div class="', in_array($style['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>
<h3 class="', $style['title']['class'], '">
<span class="sp_float_left sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a>
</h3>
</div>';
}

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}

echo '
<div', empty($style['body']['class']) ? '' : ' class="' . $style['body']['class'] . '"', '>';

if (empty($style['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}

echo '
<div class="sp_content_padding"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', '>';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" class="sp_float_right" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '</div>
<div class="sp_right">', $news['link'], ' ',  $news['new_comment'], '</div>
</div>';

if (empty($style['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}

echo '
</div>';

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}

echo '
</div>';

if ($key % 2 == 0)
echo '
</div>';
}
}

echo !empty($return) && count($return) % 2 == 0 ? '
</div>' : '';

if (!empty($per_page))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $page_index, '</div>';
}


You can change the $width variable at the onset of the function to ie. 49.5% if you want them a bit closer together.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Xpresskonami

Quote from: Chen Zhen on October 25, 2020, 09:32:45 PM

Use notepad++ ( not ms notepad ) or another file editor that handles unix line endings properly.

file: ../Sources/PortalBlocks.php
only replace the one function I am including below inside that file.
function to replace: sp_boardNews()

function sp_boardNews($parameters, $id, $return_parameters = false)
{
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;

$width = '49%';

$block_parameters = array(
'board' => 'boards',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$start = !empty($parameters['start']) ? (int) $parameters['start'] : 0;
$length = isset($parameters['length']) ? (int) $parameters['length'] : 250;
$avatars = !empty($parameters['avatar']);
$per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0;
$style = !empty($parameters['style']) ? $parameters['style'] : sportal_parse_style('explode', '', true);

$limit = max(0, $limit);
$start = max(0, $start);

loadLanguage('Stats');

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$request = $smcFunc['db_query']('', '
SELECT t.id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE {query_see_board}
AND ' . (empty($board) ? 't.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
AND (t.locked != {int:locked} OR m.icon != {string:icon})
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5),
'is_approved' => 1,
'locked' => 1,
'icon' => 'moved',
'limit' => $limit,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
elseif (!empty($per_page))
{
$limit = count($posts);
$start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0;

$clean_url = str_replace('%', '%%', preg_replace('~news' . $id . '=[^;]+;?~', '', $_SERVER['REQUEST_URL']));
$current_url = $clean_url . (strpos($clean_url, '?') !== false ? (in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';') : '?');

$page_index = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true);
}

$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar,
a.id_attach, a.attachment_type, a.filename, t.num_views
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}',
array(
'post_list' => $posts,
'start' => $start,
'limit' => !empty($per_page) ? $per_page : $limit,
)
);
$return = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$limited = false;
if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$limited = true;
}
elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);
$limited = true;
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

if ($modSettings['sp_resize_images'])
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);

if (!empty($row['id_member']))
$colorids[$row['id_member']] = $row['id_member'];

$return[] = array(
'id' => $row['id_topic'],
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'views' => $row['num_views'],
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp-read_more'] . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}

$return[count($return) - 1]['is_last'] = true;

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

if ($context['SPortal']['core_compat'])
{
foreach ($return as $news)
{
echo '
<div class="sp_article_content">
<div class="', !empty($style['no_body']) ? '' : ' tborder', '">
<table class="sp_block">';

if (empty($style['no_title']))
{
echo '
<tr>
<td class="sp_middle ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>', $news['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '><a href="', $news['href'], '">', $news['subject'], '</a></td>
</tr>';
}

echo '
<tr>
<td class="sp_block_padding', empty($style['body']['class']) ? '' : ' ' . $style['body']['class'], '"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', ' colspan="2">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" style="float: right;" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '<br /><br /></div>
<div class="sp_right ">', $news['link'], ' ',  $news['new_comment'], '</div>
</td>
</tr>
</table>
</div>
</div>';
}
}
else
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div>
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

if (empty($style['no_title']))
{
echo '
<div class="', in_array($style['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>
<h3 class="', $style['title']['class'], '">
<span class="sp_float_left sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a>
</h3>
</div>';
}

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}

echo '
<div', empty($style['body']['class']) ? '' : ' class="' . $style['body']['class'] . '"', '>';

if (empty($style['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}

echo '
<div class="sp_content_padding"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', '>';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" class="sp_float_right" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '</div>
<div class="sp_right">', $news['link'], ' ',  $news['new_comment'], '</div>
</div>';

if (empty($style['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}

echo '
</div>';

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}

echo '
</div>';

if ($key % 2 == 0)
echo '
</div>';
}
}

echo !empty($return) && count($return) % 2 == 0 ? '
</div>' : '';

if (!empty($per_page))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $page_index, '</div>';
}


You can change the $width variable at the onset of the function to ie. 49.5% if you want them a bit closer together.

Ok let me give it a trials

Xpresskonami

Quote from: Chen Zhen on October 25, 2020, 09:32:45 PM

Use notepad++ ( not ms notepad ) or another file editor that handles unix line endings properly.

file: ../Sources/PortalBlocks.php
only replace the one function I am including below inside that file.
function to replace: sp_boardNews()

function sp_boardNews($parameters, $id, $return_parameters = false)
{
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;

$width = '49%';

$block_parameters = array(
'board' => 'boards',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$start = !empty($parameters['start']) ? (int) $parameters['start'] : 0;
$length = isset($parameters['length']) ? (int) $parameters['length'] : 250;
$avatars = !empty($parameters['avatar']);
$per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0;
$style = !empty($parameters['style']) ? $parameters['style'] : sportal_parse_style('explode', '', true);

$limit = max(0, $limit);
$start = max(0, $start);

loadLanguage('Stats');

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$request = $smcFunc['db_query']('', '
SELECT t.id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE {query_see_board}
AND ' . (empty($board) ? 't.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
AND (t.locked != {int:locked} OR m.icon != {string:icon})
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5),
'is_approved' => 1,
'locked' => 1,
'icon' => 'moved',
'limit' => $limit,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
elseif (!empty($per_page))
{
$limit = count($posts);
$start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0;

$clean_url = str_replace('%', '%%', preg_replace('~news' . $id . '=[^;]+;?~', '', $_SERVER['REQUEST_URL']));
$current_url = $clean_url . (strpos($clean_url, '?') !== false ? (in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';') : '?');

$page_index = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true);
}

$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar,
a.id_attach, a.attachment_type, a.filename, t.num_views
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}',
array(
'post_list' => $posts,
'start' => $start,
'limit' => !empty($per_page) ? $per_page : $limit,
)
);
$return = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$limited = false;
if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$limited = true;
}
elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);
$limited = true;
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

if ($modSettings['sp_resize_images'])
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);

if (!empty($row['id_member']))
$colorids[$row['id_member']] = $row['id_member'];

$return[] = array(
'id' => $row['id_topic'],
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'views' => $row['num_views'],
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp-read_more'] . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}

$return[count($return) - 1]['is_last'] = true;

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

if ($context['SPortal']['core_compat'])
{
foreach ($return as $news)
{
echo '
<div class="sp_article_content">
<div class="', !empty($style['no_body']) ? '' : ' tborder', '">
<table class="sp_block">';

if (empty($style['no_title']))
{
echo '
<tr>
<td class="sp_middle ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>', $news['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '><a href="', $news['href'], '">', $news['subject'], '</a></td>
</tr>';
}

echo '
<tr>
<td class="sp_block_padding', empty($style['body']['class']) ? '' : ' ' . $style['body']['class'], '"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', ' colspan="2">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" style="float: right;" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '<br /><br /></div>
<div class="sp_right ">', $news['link'], ' ',  $news['new_comment'], '</div>
</td>
</tr>
</table>
</div>
</div>';
}
}
else
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div>
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

if (empty($style['no_title']))
{
echo '
<div class="', in_array($style['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>
<h3 class="', $style['title']['class'], '">
<span class="sp_float_left sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a>
</h3>
</div>';
}

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}

echo '
<div', empty($style['body']['class']) ? '' : ' class="' . $style['body']['class'] . '"', '>';

if (empty($style['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}

echo '
<div class="sp_content_padding"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', '>';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" class="sp_float_right" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '</div>
<div class="sp_right">', $news['link'], ' ',  $news['new_comment'], '</div>
</div>';

if (empty($style['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}

echo '
</div>';

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}

echo '
</div>';

if ($key % 2 == 0)
echo '
</div>';
}
}

echo !empty($return) && count($return) % 2 == 0 ? '
</div>' : '';

if (!empty($per_page))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $page_index, '</div>';
}


You can change the $width variable at the onset of the function to ie. 49.5% if you want them a bit closer together.

NO CHANGES AFTER PASTING THIS CODE

Chen Zhen


Am I correct about this concerning the "board news" block ?

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen

Try the one here:

function sp_boardNews($parameters, $id, $return_parameters = false)
{
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;

$width = '48%';

$block_parameters = array(
'board' => 'boards',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$start = !empty($parameters['start']) ? (int) $parameters['start'] : 0;
$length = isset($parameters['length']) ? (int) $parameters['length'] : 250;
$avatars = !empty($parameters['avatar']);
$per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0;
$style = !empty($parameters['style']) ? $parameters['style'] : sportal_parse_style('explode', '', true);

$limit = max(0, $limit);
$start = max(0, $start);

loadLanguage('Stats');

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$request = $smcFunc['db_query']('', '
SELECT t.id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE {query_see_board}
AND ' . (empty($board) ? 't.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
AND (t.locked != {int:locked} OR m.icon != {string:icon})
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5),
'is_approved' => 1,
'locked' => 1,
'icon' => 'moved',
'limit' => $limit,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
elseif (!empty($per_page))
{
$limit = count($posts);
$start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0;

$clean_url = str_replace('%', '%%', preg_replace('~news' . $id . '=[^;]+;?~', '', $_SERVER['REQUEST_URL']));
$current_url = $clean_url . (strpos($clean_url, '?') !== false ? (in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';') : '?');

$page_index = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true);
}

$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar,
a.id_attach, a.attachment_type, a.filename, t.num_views
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}',
array(
'post_list' => $posts,
'start' => $start,
'limit' => !empty($per_page) ? $per_page : $limit,
)
);
$return = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$limited = false;
if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$limited = true;
}
elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);
$limited = true;
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

if ($modSettings['sp_resize_images'])
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);

if (!empty($row['id_member']))
$colorids[$row['id_member']] = $row['id_member'];

$return[] = array(
'id' => $row['id_topic'],
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'views' => $row['num_views'],
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp-read_more'] . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}

$return[count($return) - 1]['is_last'] = true;

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

if ($context['SPortal']['core_compat'])
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div style="padding-top: 0.3em;">
<div style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

echo '
<div class="sp_article_content">
<div class="', !empty($style['no_body']) ? '' : ' tborder', '">
<table class="sp_block">';

if (empty($style['no_title']))
{
echo '
<tr>
<td class="sp_middle ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>', $news['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '><a href="', $news['href'], '">', $news['subject'], '</a></td>
</tr>';
}

echo '
<tr>
<td class="sp_block_padding', empty($style['body']['class']) ? '' : ' ' . $style['body']['class'], '"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', ' colspan="2">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" style="float: right;" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '<br /><br /></div>
<div class="sp_right ">', $news['link'], ' ',  $news['new_comment'], '</div>
</td>
</tr>
</table>
</div>
</div>';

if ($key % 2 == 0)
echo '
</div>
</div>';
else
echo '
</div>';
$lastBody = !empty($style['no_body']) ? '' : 'cla tborder';


}

echo !empty($return) && count($return) % 2 != 0 ? '
<div class="sp_block_section" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">
<div class="sp_article_content">
<div>
<table class="sp_block">
<tr>
<td class="sp_block_padding" colspan="2">
&nbsp;
</td>
</tr>
</table>
</div>
</div>
</div>
</div>' : '';
}
else
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div style="padding-top: 0.3em;">
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

if (empty($style['no_title']))
{
echo '
<div class="', in_array($style['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>
<h3 class="', $style['title']['class'], '">
<span class="sp_float_left sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a>
</h3>
</div>';
}

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}

echo '
<div', empty($style['body']['class']) ? '' : ' class="' . $style['body']['class'] . '"', '>';

if (empty($style['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}

echo '
<div class="sp_content_padding"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', '>';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" class="sp_float_right" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '</div>
<div class="sp_right">', $news['link'], ' ',  $news['new_comment'], '</div>
</div>';

if (empty($style['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}

echo '
</div>';

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}

echo '
</div>';

if ($key % 2 == 0)
echo '
</div>';
}

echo !empty($return) && count($return) % 2 != 0 ? '
</div>' : '';
}

if (!empty($per_page))
echo '
<div class="sp_page_index centertext">', $txt['sp-articlesPages'], ': ', $page_index, '</div>';
}


In your block settings it's better if you have the amount of topics set to an even number & also the block position at the top of the section list.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Xpresskonami

Quote from: Chen Zhen on October 26, 2020, 02:50:11 PM
Try the one here:

function sp_boardNews($parameters, $id, $return_parameters = false)
{
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;

$width = '48%';

$block_parameters = array(
'board' => 'boards',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$start = !empty($parameters['start']) ? (int) $parameters['start'] : 0;
$length = isset($parameters['length']) ? (int) $parameters['length'] : 250;
$avatars = !empty($parameters['avatar']);
$per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0;
$style = !empty($parameters['style']) ? $parameters['style'] : sportal_parse_style('explode', '', true);

$limit = max(0, $limit);
$start = max(0, $start);

loadLanguage('Stats');

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$request = $smcFunc['db_query']('', '
SELECT t.id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE {query_see_board}
AND ' . (empty($board) ? 't.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
AND (t.locked != {int:locked} OR m.icon != {string:icon})
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5),
'is_approved' => 1,
'locked' => 1,
'icon' => 'moved',
'limit' => $limit,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
elseif (!empty($per_page))
{
$limit = count($posts);
$start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0;

$clean_url = str_replace('%', '%%', preg_replace('~news' . $id . '=[^;]+;?~', '', $_SERVER['REQUEST_URL']));
$current_url = $clean_url . (strpos($clean_url, '?') !== false ? (in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';') : '?');

$page_index = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true);
}

$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar,
a.id_attach, a.attachment_type, a.filename, t.num_views
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}',
array(
'post_list' => $posts,
'start' => $start,
'limit' => !empty($per_page) ? $per_page : $limit,
)
);
$return = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$limited = false;
if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$limited = true;
}
elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);
$limited = true;
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

if ($modSettings['sp_resize_images'])
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);

if (!empty($row['id_member']))
$colorids[$row['id_member']] = $row['id_member'];

$return[] = array(
'id' => $row['id_topic'],
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'views' => $row['num_views'],
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp-read_more'] . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}

$return[count($return) - 1]['is_last'] = true;

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

if ($context['SPortal']['core_compat'])
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div style="padding-top: 0.3em;">
<div style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

echo '
<div class="sp_article_content">
<div class="', !empty($style['no_body']) ? '' : ' tborder', '">
<table class="sp_block">';

if (empty($style['no_title']))
{
echo '
<tr>
<td class="sp_middle ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>', $news['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth ', $style['title']['class'], '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '><a href="', $news['href'], '">', $news['subject'], '</a></td>
</tr>';
}

echo '
<tr>
<td class="sp_block_padding', empty($style['body']['class']) ? '' : ' ' . $style['body']['class'], '"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', ' colspan="2">';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" style="float: right;" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '<br /><br /></div>
<div class="sp_right ">', $news['link'], ' ',  $news['new_comment'], '</div>
</td>
</tr>
</table>
</div>
</div>';

if ($key % 2 == 0)
echo '
</div>
</div>';
else
echo '
</div>';
$lastBody = !empty($style['no_body']) ? '' : 'cla tborder';


}

echo !empty($return) && count($return) % 2 != 0 ? '
<div class="sp_block_section" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">
<div class="sp_article_content">
<div>
<table class="sp_block">
<tr>
<td class="sp_block_padding" colspan="2">
&nbsp;
</td>
</tr>
</table>
</div>
</div>
</div>
</div>' : '';
}
else
{
foreach ($return as $key => $news)
{
if ($key % 2 == 0)
echo '
<div style="padding-top: 0.3em;">
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: left;padding-right: 1em;">';
else
echo '
<div class="sp_article_content" style="display: inline !important;width: ' . $width . ';float: right;padding-left: 1em;">';

if (empty($style['no_title']))
{
echo '
<div class="', in_array($style['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($style['title']['style']) ? ' style="' . $style['title']['style'] . '"' : '', '>
<h3 class="', $style['title']['class'], '">
<span class="sp_float_left sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a>
</h3>
</div>';
}

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}

echo '
<div', empty($style['body']['class']) ? '' : ' class="' . $style['body']['class'] . '"', '>';

if (empty($style['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}

echo '
<div class="sp_content_padding"', !empty($style['body']['style']) ? ' style="' . $style['body']['style'] . '"' : '', '>';

if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"><img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" width="30" class="sp_float_right" /></a>
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';
else
echo '
<div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>';

echo '
<div class="post"><hr />', $news['body'], '</div>
<div class="sp_right">', $news['link'], ' ',  $news['new_comment'], '</div>
</div>';

if (empty($style['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}

echo '
</div>';

if (strpos($style['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}

echo '
</div>';

if ($key % 2 == 0)
echo '
</div>';
}

echo !empty($return) && count($return) % 2 != 0 ? '
</div>' : '';
}

if (!empty($per_page))
echo '
<div class="sp_page_index centertext">', $txt['sp-articlesPages'], ': ', $page_index, '</div>';
}


In your block settings it's better if you have the amount of topics set to an even number & also the block position at the top of the section list.

NO CHANGES. Check

Chen Zhen

No need to yell with caps.. I am reading your posts.

What I posted for you was indeed for the board news block.
The second edit that I posted affected both core & curve template layouts.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

pretor

Hello ;)

For many years (9 years) I use the portal "sipmpleportal" in various forums and so far I have been very pleased him. Unfortunately, I see that update last one was held in 2017 and aid forum just died and it worries me greatly. or portal "simpleportal" will be updated even if there is a possibility that someone tried to make it "responsive", so that the content displayed by the portal, tailored to smartphone and tablet screens?

PS. Sorry for my english but I'm using the google translator.

Quote from: PolishOd wielu lat (9 lat) używam portalu "SipmplePortal" na różnych forach i do tej pory byłem niego bardzo zadowolony.
Niestety widzę, że ostania aktualizacja, odbyła się w 2017 roku a forum pomocowe zwyczajnie umarło i mocno mnie to martwi.

Czy portal "SimplePortal" będzie jeszcze aktualizowany, czy istnieje możliwość aby ktoś spróbował zrobić go "responsywnym", tak aby wyświetlane przez portal treści, dopasować do ekranów smartphone i tabletów ?

SMF.pl [nofollow]
VW-ClubPolska.pl [nofollow]

Deaks

their are no known plans for it to be updates.  Their is a fork for 2.1 but main SP is unlikley to move forward.
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Shades.

Anybody have a copy of the ehportal. I tried clicking on the link but not working...https://web-develop.ca/index.php?action=downloads;area=stable_eh_portal
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

Quote from: RML on February 07, 2019, 08:06:43 AM
You can use EhPortal, it's the same as Simple Portal only for SMF 2.1, it works with RC1, I use it on my forum and it works fine.
Do you have a copy I can download? The link to download it doesn't work...https://web-develop.ca/index.php?action=downloads;area=stable_eh_portal
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Mick.


Shades.

ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Mick.

Quote from: Shades. on November 11, 2020, 02:25:35 PM
Quote from: Mick. on November 11, 2020, 02:12:22 PM
Try this.. https://web-develop.ca/index.php?action=downloads;area=stable_eh_portal;file=2
None of the links to web-develop work for me (been trying since yesterday)
clear your web browser cache. The site works for me just fine.

Bigguy

Works fine for me as well.

Shades.

Well dang I cant get it to work and I tried 3 different browsers! :(
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Bigguy

Maybe your DNS cache needs clearing.

Advertisement: