TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,163
  • Total Topics: 21,351
  • Online today: 816
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 176
  • Total: 177
  • lurkalot

help needed to get my code working again

Started by knat, January 06, 2007, 09:54:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knat

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

G6Cad

<img src="', $topic['first_post']['icon_url'], '" />

Try that one instead  (im no coder, but it seemd to be one " to many in there)

knat

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

G6Cad


knat

#4
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 ??


IchBin

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" />',
);

knat

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

IchBin

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.

knat

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

everything looks fine until somebody makes a reply to my topic and it gets this icon

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  :)

IchBin

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.