Welcome to Geeklog, Anonymous Friday, November 22 2024 @ 11:16 am EST

Geeklog Forums

Indicating recent comments


Status: offline

daveshorts

Forum User
Newbie
Registered: 09/23/03
Posts: 7
I was finding it difficult to find recent comments when in nested comment mode, so I added a couple of lines of code to put a red 'New' in the comment header if it is in the the new comments block.

Is this a sensible way of doing this, or any use to anyone?

to lib_common.php

**This line number may be wrong it should go before the $A['nice_date'] = strftime... line**

2910c2910,2911
<
---
> if( time()-$A['nice_date']<$_CONF['newcommentsinterval'] ){$isnew=" <font color='red'>New</font>";}
> else{$isnew='';}
2917c2918
< $retval .= ' ' . $LANG01[36] . ' ' . $A['nice_date'] . '</td></tr>' . LB
---
> $retval .= ' ' . $LANG01[36] . ' ' . $A['nice_date'] . $isnew . '</td></tr>' . LB

 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
That's very cool! Thanks for sharing the code! Now all you need is a cool "New" graphic to display instead of the red text and it would be perfect.
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Hmmm, this doesn't work for me. The if statement always evaluates to false, even when I have new comments.
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Ah, I see, the problem is that $A['nice_date'] is the text version of the date at that point in the code. I had to add a new variable at the top of the function to hold the long integer version. Now it works!
 Quote

Status: offline

daveshorts

Forum User
Newbie
Registered: 09/23/03
Posts: 7
hmmm I'm using Geeklog 1.3.8-1 on linux...

the graphic would be a good idea, and should be easy just change <font..>New</font> for <img ...>

It is possible I have screwed up the line numbers somehow... it should go before:

$A['nice_date'] = strftime( $_CONF['date'], $A['nice_date'] );

or you are comparing a text date with a numeric datestamp
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Oops, I misread it. I read it quickly and didn't see that the changes are in two different places. Oops!

Plus, my line numbers are all screwed up, anyways, since I have already hacked the file. Wink

Thanks again!
 Quote

daveshorts

Anonymous
Just to improve things / make them more complex.

this will make the 'New's slowly become more dull as time goes on, so the new ones appear the brightest.

2910c2910,2911
---
> if( time()-$A['nice_date']New";}

> else{$isnew='';}
2917c2918
' . LB
---
> $retval .= ' ' . $LANG01[36] . ' ' . $A['nice_date'] . $isnew . '' . LB
 Quote

daveshorts

Anonymous
Sorry I meant

2910c2910,2911
---
> if( time()-$A['nice_date']New";}

> else{$isnew='';}
2917c2918
' . LB
---
> $retval .= ' ' . $LANG01[36] . ' ' . $A['nice_date'] . $isnew . '' . LB

 Quote

daveshorts

Anonymous
Ok I am really incompetent and should learn to use preview functions
Text Formatted Code
2910c2910,2911
<
---
> if( time()-$A['nice_date']<$_CONF['newcommentsinterval'] ){$isnew=" <font color='#".dechex(round(255*(1-(time()-$A['nice_date'])/$_CONF['newcommentsinterval']))^3)."0000'>New</font>";}> else{$isnew='';}
2917c2918
< $retval .= ' ' . $LANG01[36] . ' ' . $A['nice_date'] . '</td></tr>' . LB
---
> $retval .= ' ' . $LANG01[36] . ' ' . $A['nice_date'] . $isnew . '</td></tr>' . LB
 

 Quote

All times are EST. The time is now 11:16 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content