|
|
Joined: Feb 2002
Posts: 950
Hacker
|
|
Hacker
Joined: Feb 2002
Posts: 950 |
Tweaking the query a bit, I change the format of the Current Threads. It now shows the threads which have been replied to most recently, the subject and how long ago since the reply was posted. http://www.viperalley.com/summary.php?Cat= If anyone likes it, I'll post the simple changes.
|
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Groovy idea!  And you might as well post the changes, because you know you're going to get swamped with posts! 
|
|
|
|
|
Joined: Feb 2002
Posts: 950
Hacker
|
|
Hacker
Joined: Feb 2002
Posts: 950 |
:lol: true.
Well, the changes are not too difficult - adds a LEFT JOIN to the query to get some additional info. One thing I did notice is the "new" threads dont have the username appearing, so am looking into how to do that without adding another query. For now I just post new threads without a username and nobody notices.
|
|
|
|
|
Joined: Aug 2003
Posts: 160
Junior Member
|
|
Junior Member
Joined: Aug 2003
Posts: 160 |
ahem... Exactly where are the "simple changes?" I have searched Low but not high yet.. Hoped you could save me some time...
Last edited by ST; 10/20/2003 8:03 PM.
|
|
|
|
|
Joined: Feb 2002
Posts: 950
Hacker
|
|
Hacker
Joined: Feb 2002
Posts: 950 |
Well, here's what I use: <?<br /><br />if ( $LastCacheTime == 0 || !$CurrentThreadsData ) {<br /> $boardq2 = str_replace("B_", "p.B_", $boardquery);<br /> <br /> $query = "<br /> SELECT p.B_Number,p.B_Posted,p.B_Last_Post,p.B_Subject,p.B_Main,p.B_Replies,p.B_Counter,p.B_Board,u.U_UserName,b.Bo_Title<br /> FROM {$config['tbprefix']}Posts AS p<br /> LEFT JOIN {$config['tbprefix']}Boards AS b ON b.Bo_Keyword = p.B_Board<br /> LEFT JOIN {$config['tbprefix']}Users AS u ON u.U_Number = p.B_LastPosterId<br /> WHERE p.B_Number = p.B_Main<br /> AND (p.B_Sticky = 0 OR p.B_Sticky IS NULL)<br /> $boardq2<br /> ORDER BY p.B_Last_Post DESC<br /> LIMIT $totalcurrentthreads<br /> ";<br /><br /> $sth = $dbh -> do_query($query);<br /><br /> $c = 0;<br /> $curtime = $html -> get_date(); <br /> <br /> $myString = "$tbopen<tr><td align=\"center\" class=\"tdheader\">{$pal_CurrentThreads[0]}</td></tr><tr><td align=\"left\" valign=\"top\" class=\"lighttable\"><table width=\"100%\">";<br /> while ( list($palNumber,$palPosted,$palLast,$palSubject,$palMain,$palReplies,$palCounter,$palKeyword,$palPoster,$palBoTitle) = $dbh -> fetch_array($sth)) {<br /> $c++;<br /> $timepast = round(($curtime - $palLast)/60);<br /> if ( $timepast > 1 ) $timepast = "$timepast minutes ago";<br /> elseif ( $timepast == 1 ) $timepast = "$timepast minute ago";<br /> else $timepast = "just now";<br /> <br /> if ( !empty($palPoster) ) $palPoster = " by $palPoster"; <br /> if ( strlen($palSubject) > 30 ) $palSubject = substr($palSubject,0,30) . "...";<br /> <br /> $myString .= "<tr><td align=\"left\" valign=\"top\" class=\"lighttable\">$spacer</td><td align=\"left\" valign=\"top\" class=\"lighttable\"><font class=\"small\">$palBoTitle: <a href=\"{$config['phpurl']}/showflat.php/Cat/$Cat/Board/$palKeyword/Number/$palNumber\">$palSubject</a>$palPoster ($timepast)</font></td></tr>";<br /> }<br /> if ($c < 1) {$myString .= "<tr><td class=\"lighttable\">{$pal_CurrentThreads[1]}</td></tr>";}<br /> <br /> $myString .= "</table></td></tr>$tbclose<br />";<br /> $CurrentThreadsStorageString = $myString;<br /> $dbh -> finish_sth($sth);<br />}<br />else {<br /> $myString = $CurrentThreadsData;<br /> $CurrentThreadsStorageString = $CurrentThreadsData;<br />}<br /><br />echo $myString;<br />?>But you should be warned ahead of time, this can be a hog. I finally set up a cronjob to rebuild my cache every 5 minutes because my summary page was taking 2-3 seconds to generate. You can give it a try, but I dont know if I can recommend it.
|
|
|
|
|
Joined: Aug 2003
Posts: 160
Junior Member
|
|
Junior Member
Joined: Aug 2003
Posts: 160 |
I copied the code precisely as entered there. It works great, until the link within is clicked to go to the referring topic. It then says "No input file specified."
I compared the link referrences in the old current threads to what you had psoted and saw a discrepancy. Your mod made the link look like "http://www.mysite.net/bomberjackets/showflat.php/Cat//Board/unearth/Number/10829"
where the old current threads made the link: "http://www.mysite.net/ashes/showflat.php?Cat=&Board=UBB1&Number=11025"
I highlighted the parts I think are causing the problem as all the other links on my site look like the second example.
I played around with it a but but cannot seem to remedy it. Any advice would be appreciated.
|
|
|
|
|
Joined: Aug 2003
Posts: 160
Junior Member
|
|
Junior Member
Joined: Aug 2003
Posts: 160 |
OK... I figured it out.. sorry for the premature venting... now I have another error to discuss.... I will psot it elsewhere...
Again, thanks.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 5,834
Joined: January 2000
|
|
|
Forums63
Topics37,583
Posts293,955
Members13,824
| |
Most Online151,614 Nov 14th, 2025
|
|
Currently Online 4888
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 29
|
|
|
|