Skip to main content
Topic: [ADDON] SimplePortal (Read 155743 times) previous topic - next topic
0 Members and 5 Guests are viewing this topic.

Re: [ADDON] SimplePortal

Reply #60

I have not noticed anything important so far...not sure... ;)



Edit:

I think, I would prefere the more detailed version with three lines of text, also there will be more space for the board-titels.

So I added a third background in portal.css to get another line-height:

Code: [Select]
.portalbg3 {
padding: 10px 0;
background-color: #FDF5E6;
line-height: 1.2em;
}

Re: [ADDON] SimplePortal

Reply #61

The drag&drop of the blocks in the UI is awesome! :o
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON] SimplePortal

Reply #62

Yes, I do agree, it is very  comfortable to use it...it is made so clever. I like it very much.

I need some help with this, to keep the text on the left side always on the line, if some topicicons are bigger then others.

Can I change something here?

Code: [Select]
echo '
<div>';

foreach ($posts as $post)
{
echo '
<div style="display: table-cell; padding: 0 8px" class="centericon">
', $post['icon'], '
</div>
<div class="" style="display: table-cell">
<b><a href="', $post['href'], '">', $post['subject'], '</a></b>
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><span class="new_posts"> ' . $txt['new'] . '</span></a>';

echo '
<div class="smalltext">
', $txt['by'], ' ', $post['poster']['link'], ' ', $txt['in'], ' ', $post['board']['link'], '
</br />
', $post['time'], ' Uhr | ', $txt['views'], ': ', $post['views'], ' | ', $txt['replies'], ': ', $post['replies'], '
</div>';

if ($show_body)
echo '
<div class="middletext">
', $post['preview'], '
</div>';

echo '
</div>
<hr>';
}

Re: [ADDON] SimplePortal

Reply #63

Not sure TBH.
If it is the code Spuds posted few messages before, you may try using this instead:
Code: [Select]
	global $context, $settings, $scripturl, $txt, $user_info, $modSettings, $posts, $color_profile;

$db = database();

$exclude_boards = null;
$num_recent = !empty($parameters[0]) ? $parameters[0] : (isset($_GET['limit']) ? (int) $_GET['limit'] : 20);
$show_body = !empty($parameters[1]) ? $parameters[1] : false;

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() : $exclude_boards;

$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';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $db->query('', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, t.num_replies, t.num_views, b.name AS bName,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.ID_MSG, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ', LEFT(m.body, 384) AS body, m.smileys_enabled, mf.icon
FROM ({db_prefix}messages AS m, {db_prefix}topics AS t, {db_prefix}boards AS b, {db_prefix}messages AS ms)
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:id_member})' : '') . '
WHERE t.id_last_msg >= ' . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . '
AND t.id_last_msg = m.id_msg
AND b.id_board = t.id_board' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
AND {raw:query_see_board}
AND ms.id_msg = t.id_last_msg
ORDER BY t.id_last_msg DESC
LIMIT {int:limit}',
array(
'id_member' => $user_info['id'],
'exclude_boards' => $exclude_boards,
'query_see_board' => $user_info['query_wanna_see_board'],
'limit' => (int) $num_recent,
)
);
$posts = array();
$color_ids = array();
while ($row = $db->fetch_assoc($request))
{
// Shorten the body if needed
if ($show_body)
{
$ellip = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
$row['body'] = Util::shorten_html(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), 128, $ellip, false);
censorText($row['body']);
}

// Censor the subject.
$row['subject'] = preg_replace('/^' . preg_quote($txt['response_prefix']) . '/', '', $row['subject']);
censorText($row['subject']);

// Collect the color ids :)
$color_ids[$row['id_member']] = $row['id_member'];

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

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['id_topic'],
'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']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => Util::shorten_text($row['subject'], 25),
'preview' => $show_body ? $row['body'] : '',
'time' => standardTime($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new">' . $row['subject'] . '</a>',
'new' => !empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" style="vertical-align: middle;" alt="' . $row['icon'] . '" />',
'views' => $row['num_views'],
'replies' => $row['num_replies'],
);
}
$db->free_result($request);

// Colorization
if (!empty($color_ids) && sp_loadColors($color_ids) !== false)
{
foreach ($posts as $key => $value)
{
if (!empty($color_profile[$value['poster']['id']]['link']))
$posts[$key]['poster']['link'] = $color_profile[$value['poster']['id']]['link'];
}
}

$context['recent_topics'] = $posts;

// Just return if we have no results
if (empty($posts))
return $txt['error_sp_no_posts_found'];

echo '
<div>';

foreach ($posts as $post)
{
echo '
<div style="display: table-row">
<div style="display: table-cell; padding: 0 8px" class="centericon">
', $post['icon'], '
</div>
<div class="" style="display: table-cell">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><span class="new_posts"> ' . $txt['new'] . '</span></a>';

echo '
<div class="middletext">
', $txt['by'], ' ', $post['poster']['link'], ' ', $txt['in'], ' ', $post['board']['link'], '
</br />
', $post['time'], ' | ', $txt['views'], ': ', $post['views'], ' | ', $txt['replies'], ': ', $post['replies'], '
</div>';

if ($show_body)
echo '
<div class="middletext">
', $post['preview'], '
</div>';

echo '
</div>
</div>';
}

echo '
</div>';

Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON] SimplePortal

Reply #64

Thank you very much, emanuele, yes, it is the same code Spuds wrote - I had only changed the font a little.

The text is now on the line - perfect! :)

But the horizontal border beetween the posts is missing.

Re: [ADDON] SimplePortal

Reply #65

I have tried to add one...but it don't looks nice... :-[

Re: [ADDON] SimplePortal

Reply #66

Instead of:
Code: [Select]
<div style="display: table-row">
something like:
Code: [Select]
<div style="display: table-row;border-bottom: 1px solid #000">
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON] SimplePortal

Reply #67

Thank you very much, emanuele...

But it is not working... :( there are no borders shown...

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

$db = database();

$exclude_boards = null;
$num_recent = !empty($parameters[0]) ? $parameters[0] : (isset($_GET['limit']) ? (int) $_GET['limit'] : 20);
$show_body = !empty($parameters[1]) ? $parameters[1] : false;

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() : $exclude_boards;

$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';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $db->query('', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, t.num_replies, t.num_views, b.name AS bName,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.ID_MSG, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ', LEFT(m.body, 384) AS body, m.smileys_enabled, mf.icon
FROM ({db_prefix}messages AS m, {db_prefix}topics AS t, {db_prefix}boards AS b, {db_prefix}messages AS ms)
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:id_member})' : '') . '
WHERE t.id_last_msg >= ' . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . '
AND t.id_last_msg = m.id_msg
AND b.id_board = t.id_board' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
AND {raw:query_see_board}
AND ms.id_msg = t.id_last_msg
ORDER BY t.id_last_msg DESC
LIMIT {int:limit}',
array(
'id_member' => $user_info['id'],
'exclude_boards' => $exclude_boards,
'query_see_board' => $user_info['query_wanna_see_board'],
'limit' => (int) $num_recent,
)
);
$posts = array();
$color_ids = array();
while ($row = $db->fetch_assoc($request))
{
// Shorten the body if needed
if ($show_body)
{
$ellip = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
$row['body'] = Util::shorten_html(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), 128, $ellip, false);
censorText($row['body']);
}

// Censor the subject.
$row['subject'] = preg_replace('/^' . preg_quote($txt['response_prefix']) . '/', '', $row['subject']);
censorText($row['subject']);

// Collect the color ids :)
$color_ids[$row['id_member']] = $row['id_member'];

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

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['id_topic'],
'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']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => Util::shorten_text($row['subject'], 25),
'preview' => $show_body ? $row['body'] : '',
'time' => standardTime($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new">' . $row['subject'] . '</a>',
'new' => !empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" style="vertical-align: middle;" alt="' . $row['icon'] . '" />',
'views' => $row['num_views'],
'replies' => $row['num_replies'],
);
}
$db->free_result($request);

// Colorization
if (!empty($color_ids) && sp_loadColors($color_ids) !== false)
{
foreach ($posts as $key => $value)
{
if (!empty($color_profile[$value['poster']['id']]['link']))
$posts[$key]['poster']['link'] = $color_profile[$value['poster']['id']]['link'];
}
}

$context['recent_topics'] = $posts;

// Just return if we have no results
if (empty($posts))
return $txt['error_sp_no_posts_found'];

echo '
<div>';

foreach ($posts as $post)
{
echo '
<div style="display: table-row; border-bottom: 1px solid #6394BD">
<div style="display: table-cell; padding: 0 8px" class="centericon">
', $post['icon'], '
</div>
<div class="" style="display: table-cell">
<b><a href="', $post['href'], '">', $post['subject'], '</a></b>
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><span class="new_posts"> ' . $txt['new'] . '</span></a>';

echo '
<div class="smalltext">
', $txt['by'], ' ', $post['poster']['link'], ' ', $txt['in'], ' ', $post['board']['link'], '
</br />
', $post['time'], ' Uhr | ', $txt['views'], ': ', $post['views'], ' | ', $txt['replies'], ': ', $post['replies'], '
</div>';

if ($show_body)
echo '
<div class="middletext">
', $post['preview'], '
</div>';

echo '
</div>
</div>';
}

echo '
</div>';

Such codes are very difficult to me...all those "divs"... ::) I never can figure it out how it works, if they are used...



Edit:

Maybe it would be much more easier to use topicincons, wich have all the same size.
Last Edit: September 16, 2014, 05:50:10 am by Ruth

Re: [ADDON] SimplePortal

Reply #68

Okay, scrap the previous change, and try this:
Code: [Select]
		<div style="display: table-row">
<div style="display: table-cell; padding: 0 8px" class="centericon">
', $post['icon'], '
</div>
<div class="" style="display: table-cell">
to:
Code: [Select]
		<div style="display: table-row">
<div style="display: table-cell; padding: 0 8px;border-bottom:1px solid #000;" class="centericon">
', $post['icon'], '
</div>
<div class="" style="display: table-cell;border-bottom:1px solid #000;width:100%;">
Bugs creator.
Features destroyer.
Template killer.


Re: [ADDON] SimplePortal

Reply #70

Is there any possibility to get the icons centered in this code?

I have tried several things with topicicons all at the same width - but they may not have a width more than 18 px, wich is too small for some of them. If the xx.png is more than 18px in height it will not be shown complete in the boards.  I  can change this here:

Code: [Select]
.topicicon:before {
height: 18px;
width: 18px;
}

But if I change it for example to a height of 20 px, I cannot use the topicicons.png from ElkArte at all...and need to change all of them. I think I will do this, if this is the only way to get this icons centered.
Last Edit: September 16, 2014, 04:19:15 pm by Ruth

Re: [ADDON] SimplePortal

Reply #71

Code: [Select]
text-align: center;
on the <div> containing the icon. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON] SimplePortal

Reply #72

I beg your pardon, emanuele...I am too stupid... O:-)  I have tried it for hours to get them centered.

Please tell me where exactly and how...

Code: [Select]
		<div style="display: table-row">
<div style="display: table-cell; padding: 0 8px;border-bottom:1px dashed #6394BD;" class="centericon">
', $post['icon'], '
</div>

Re: [ADDON] SimplePortal

Reply #73

Code: [Select]
		<div style="display: table-row">
<div style="display: table-cell; padding: 0 8px;border-bottom:1px dashed #6394BD;text-align: center;" class="centericon">
', $post['icon'], '
</div>
Something like that should work I think. ;)

inline styles are piling up at an worrying rate. lol
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON] SimplePortal

Reply #74

Yes! It worked!  :D   Hurrah! I am so happy now...

Thank you very much, Spuds and Emanuele for your help!