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

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 10:31:03 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 212
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 53
  • Total: 53

Getting the new post icon to show up for each individual post...

Started by Homer_J_S, March 05, 2005, 03:50:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Homer_J_S

I posted this in the Theme forum but thought I would post it here also. Didn't know quite where this post fit. If its not supposed to be in this forumn just delete. Thanks. 

First let me say Thank you,  Thank you, thank you for your wonderful theme (Helios-Red)  AND the TP project. It was exactly what I was looking for for my site and I have recieved many kudos from my small but growing user base.  ;D

Anyway, back to my question.  I have searched the SMF website looking for a mod or hack where it would show the "new" Icon besides each individual post in a thread that was new. In other words when you clicked on a post that has new post since you last visted, when you get into the thread all of the new post would have a flag with the new.gif besides the title.

The most I got off the SMF site is that you would put it on the display.template and it would be taken care of by themes. If you have any suggestions or if you could just point me in the right direction I would really appreciate it. Again this is really the only thing I am missing from my forum that my users are asking for.

Again thank you for all your hard work on the themes and TP portal, I can't tell you how much I really appreciate it.       

Bjørn

Thank you. :) I am glad you like it.

As for "new" icons in Display, I will look into it. Its primarliy Helios you would like this?

Homer_J_S

Quote from: Bloc on March 05, 2005, 05:22:21 PM
Thank you. :) I am glad you like it.

As for "new" icons in Display, I will look into it. Its primarliy Helios you would like this?
Yes. I am also running TP. So I guess it would be the Helios_tp theme. Again thanks.  ;D   

Bjørn

Find this in Display.template.php ( you could do it both in Helios and Helios_TP)
                // Done with the information about the poster... on to the post itself.
                echo '
                                                        </div>
                                                </td>
                                                <td valign="top" width="85%" height="100%">
                                                        <table width="100%" border="0"><tr>
                                                                <td align="left" valign="middle"><a href="', $message['href'], '"><img src="', $settings['images_url'], '/post/' . $message['icon'] . '.gif" alt="" border="0" /></a></td>
                                                                <td align="left" valign="middle">
                                                                        <b><a href="', $message['href'], '">', $message['subject'], '</a></b>';


And replace with this:
                // Done with the information about the poster... on to the post itself.
                echo '
                                                        </div>
                                                </td>
                                                <td valign="top" width="85%" height="100%">
                                                        <table width="100%" border="0"><tr>
                                                                <td align="left" valign="middle"><a href="', $message['href'], '"><img src="', $settings['images_url'], '/post/' . $message['icon'] . '.gif" alt="" border="0" /></a></td>
                                                                <td align="left" valign="middle">
                                                                 ' , $message['new'] ? '<img src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" align="middle" border="0" />' : '' , '
                                                                        <b><a href="', $message['href'], '">', $message['subject'], '</a></b>';


Homer_J_S

Thanks for the quick reply. It works but now the New button shows all the time. Even after the post has been read. I wonder if the command is missing an If statement. I will try and play with it.
Thanks again on the quick reply. It was just what I was looking for. I will let you know if I am succesful.   

Homer_J_S

well I wasn't quite successful. I just need one more piece of Information (i think). How would  an If statement look like to check wether or not an individual post has been read or in this case not read? I am not familiar enough with SMF to figure this out. 
Thanks. 

Bjørn

ehem. That sentence.. ' , $message['new'] ? '<img....' : ' ' , ' is the SAME as writing

if($message['new']==true)
     echo '<img...>';
else
   echo ' ';

But it seems that every post is un-read like that, not just some. i will check more on why this is.

Homer_J_S

Sorry bout that. Still learning PHP.  :-[

Thanks again for looking into this.

Bjørn

I think I found out why.

Use the same code , BUT in this sentence:

' , $message['new'] ? '<img src="'.$settings[......

put simply a ! before the variable:

' , !$message['new'] ? '<img src="'.$settings[.....

That means: if the variable $message['new'] is false, then go ahead and show the button(the <img..). In my first example I tested for if the variable was true - which was wrong. ;)

Homer_J_S

That did it. Thanks so much. Without you my site would not look half as good as it does now. And hey I also learned some things too.  ;D

Eagerly awaiting Beta 5 for TP.  ;)