SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: ddi on May 07, 2010, 03:54:48 PM

Title: Add icon to this "Recent topics" code
Post 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.



Code: [Select]
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>';
Title: Re: Add icon to this "Recent topics" code
Post by: AngelinaBelle on May 07, 2010, 04:31:07 PM
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)
Title: Re: Add icon to this "Recent topics" code
Post by: ddi on May 07, 2010, 04:41:26 PM
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.
Title: Re: Add icon to this "Recent topics" code
Post by: AngelinaBelle on May 07, 2010, 04:49:49 PM
I think I responded to the wrong post! I'm sorry!
Title: Re: Add icon to this "Recent topics" code
Post by: dannbass on May 08, 2010, 12:36:07 AM
That's pretty easy... it's already in the array! just use ' .$topic['icon']. ' wherever you want it.
Title: Re: Add icon to this "Recent topics" code
Post by: klicken on August 09, 2010, 05:50:43 AM
easy? I use the above block but i don't know where to put ' .$topic['icon']. '
i have tried,can somebody help?
Title: Re: Add icon to this "Recent topics" code
Post by: AngelinaBelle on August 09, 2010, 07:03:59 AM
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.
Title: Re: Add icon to this "Recent topics" code
Post by: klicken on August 09, 2010, 10:11:03 AM
Yes i want it right before  the subject/link.
Title: Re: Add icon to this "Recent topics" code
Post by: AngelinaBelle on August 09, 2010, 01:03:13 PM
So where the block has
Code: [Select]
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
 
 
Title: Re: Add icon to this "Recent topics" code
Post by: klicken on August 09, 2010, 01:33:12 PM
Thanks alot it worked   ;D
Title: Re: Add icon to this "Recent topics" code
Post by: klicken on August 20, 2010, 06:14:29 AM
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  :-[
Title: Re: Add icon to this "Recent topics" code
Post by: AngelinaBelle on August 20, 2010, 10:21:46 AM
Please have a look in the file at ssi_recentTopics.  This shows you how to call that function
Code: [Select]
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)
 
Code: (find) [Select]
$what = ssi_recentTopics('6', NULL, 'array');
Code: (replace) [Select]
$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:
Code: (replace) [Select]
$what = ssi_recentTopics('6', NULL, array(84, 90), 'array');
Title: Re: Add icon to this "Recent topics" code
Post by: klicken on August 22, 2010, 10:43:31 AM
Thanks alot  ;D works great
Title: Re: Add icon to this "Recent topics" code
Post by: AngelinaBelle on August 22, 2010, 07:07:39 PM
Glad to help a little bit.
SimplePortal 2.3.8 © 2008-2024, SimplePortal