SimplePortal
Customization => Blocks and Modifications => Block Requests => Topic started by: ddi on May 07, 2010, 03:54:48 PM
-
Hi, all!
I would like to add an image/icon (the same one) to the left of every title of a topic. Can you help me on that?
I use SMF 1.11.
global $scripturl, $settings, $context, $txt;
$what = ssi_recentTopics('6', NULL, 'array');
echo '
<div class="tabsmenucontent" style="padding: 5px">
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr class="titlebg">
<td valign="middle"><span class="smalltext"><font color="#F96400">Νέες δημοσιεύσεις</font></td>
<td valign="middle"><span class="smalltext"><font color="#F96400">Πίνακας</font></td>
<td valign="middle"><span class="smalltext"><font color="#F96400">Συγγραφέας</font></td>
</tr>';
foreach ($what as $topic)
{
echo '
<tr><td class="windowbg3" valign="middle">', $topic['link'];
// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '
</td>
<td class="windowbg3" valign="middle">', $topic['board']['link'], '</td>
<td class="windowbg3" valign="middle">', $topic['poster']['link'], '</td>
';
}
echo '
</td>
</tr>
</table>
</div>';
-
You might also like to see this post for an even easier approach:
http://simpleportal.net/index.php?topic=5392.0 (http://simpleportal.net/index.php?topic=5392.0)
-
Well, AngelinaBelle, thank you for your reply.
But all I want is to achieve that (add an icon to the left of each topic title) by adding code in the above code. Not to the block that contains it.
-
I think I responded to the wrong post! I'm sorry!
-
That's pretty easy... it's already in the array! just use ' .$topic['icon']. ' wherever you want it.
-
easy? I use the above block but i don't know where to put ' .$topic['icon']. '
i have tried,can somebody help?
-
This depends on where you want it. $topic['link'] is the link to the topic. You probably want it right before or after the subject/link.
-
Yes i want it right before the subject/link.
-
So where the block has
echo '
<tr><td class="windowbg3" valign="middle">', $topic['link'];
You can add your image link right before $topic['link']
For a quick refresher on the HTML img tag, have a look through a tutorial like the one at w3schools.com
-
Thanks alot it worked ;D
-
Is it possibe to exclude boards in this script?
$exclude_boards_topics = array(85,86,87,88,89); doesn't work
i guess something else is missing :-[
-
Please have a look in the file at ssi_recentTopics. This shows you how to call that function
function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo')
(looks like you have put 'array' in the 3rd parameter instead of the 4th, but the function is coded to check for that)
$what = ssi_recentTopics('6', NULL, 'array');
$what = ssi_recentTopics('6', array(85,86,87,88,89), NULL, 'array');
If what you really want is just a small number of boards included, you could write it like this instead:
$what = ssi_recentTopics('6', NULL, array(84, 90), 'array');
-
Thanks alot ;D works great
-
Glad to help a little bit.