Ok i have this block that shows the 5 latest messages on my forum.
I wanted it to keep on showing the topic icon from first post in topic so i added
<img src="', $topic['first_post']['icon_url'], '" alt="" />
to the code.. but it gives me red crosses :'(
Can anybody help me get it to work or maybe get back to the state it was before i messed around.
Here is the complete code
global $scripturl;
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
';
$what=ssi_recentTopics('5', NULL, 'array');
foreach ($what as $topic)
{
echo '
<tr>
<td class="windowbg" align="middle">
<img src="', $topic['first_post']['icon_url'], '" alt="" /></td>
<td class="windowbg" align="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['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '
</td>
<td class="windowbg" align="middle" width="20%">
', $topic['poster']['link'], '
</td>
<td class="windowbg" align="middle" width="35%">';
if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo '
<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
echo '
<span class="smalltext">
', $topic['time'], '
</span>
</td>
</tr>';
}
echo '
</table>';
<img src="', $topic['first_post']['icon_url'], '" />
Try that one instead (im no coder, but it seemd to be one " to many in there)
Hi thanks G6 :)
That looks right in my eyes.. but it still only gives me red crosses :P
when i click properties on the red cross it shows only the adress for my forum.. not the path to the icons folder :o
Try and put in an absolute path instead
Nope it simply dosnt work.. the bad thing is that i cant remember the code that was there before
I know i got this code from TP but when i find the code here it is without the icon.. strange :o
Okey i found out the original code that shows the icon of the latest post in the topic
It looks like this
<td class="windowbg" align="middle">
', $topic['icon'],' <td class="windowbg" align="middle">
So i try this to get the icon from the first post in the topic
<td class="windowbg" align="middle">
', $topic['first_post']['icon'],' <td class="windowbg" align="middle">
But that shows nothing.. not even red crosses..
Any idea what the right code could be to use.. i really hate that people reply to a topic and they dont choose any icon.. then i rather have the icon from the first post to show so that people know what subject the topic/reply is about.
Maybe it is because this code pulls from the Recent_topics_SSI so it dosnt even have the first post ??
Where are you getting first_post from? That is not part of the array in recentTopics. Here's the array so you can see what you have access to.
// 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['posterName'],
'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'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['isRead']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);
LoL Ichbin you know my php skillz can fit in a very small place.
I looked at the code used in messageindex.template.php because that always shows the icon of the first post in the topic.. and i just copied that.. without taking a backup of what was there in the first place.. i got it back to normal now and i found out that i couldnt use that array.. i guess what i wanted to do would meen having to rewrite the whole code because the SSI dont have that icon from the first post.
Thats all ;D
First post? or do you mean Last post? I don't ever recall a "first post" icon anywhere. I remember the new or last posts icons, but not a first post. Can you elaborate on that? :) Maybe we can still help.
Sometimes i have trouble explaining myself lol ;D
When i say first post i meen the user selected topic icon from the first post within the topic..
example.. i make a new topic about love and i select the heart icon for it (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fgapeindex.dk%2FThemes%2Fcovers%2Fimages%2Fpost%2Flove.gif&hash=e3c27c46d96e1551a5b181177ccbed0af6bd0b56)
everything looks fine until somebody makes a reply to my topic and it gets this icon (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fgapeindex.dk%2FThemes%2Fcovers%2Fimages%2Fpost%2Fxx.gif&hash=34b13205ea85f09945427982eddcdbf8745ebf69)
So what i wanted to do was to make it show the heart icon even if the reply had a different icon.. the way it is on the messageindex.template.php.. but i need it in my recent post code snippet :)
Ah, that makes sense now. :) I'm not sure how to do it. But I'll see if I can't find something. If I do, I'll post back.