View Full Version : Today's Posts (not last 24 hours)... layout
Today's Posts in place of latest...
1) By calendar date (ie Today)
2) Sorted by Category
3) Post time (not alpha on the subject
4) Shows total post count for today
Does not jump to the actual post in a thread, but rather the top of the thread.
This is a standard feature of the UBB, miss it dearly, members dogging me for it.
Someone? Purdy please?
Overgrow
05-04-2001, 08:08 PM
$startToday = strtotime(date("m/d/y",time()));
$endToday = ($startToday + 86400);
$query = "SELECT COUNT(threadid) as count,title,**ETC**";
$query .= " FROM THREAD";
$query .= " WHERE lastpost > '$startToday' AND lastpost < '$endToday'";
$query .= " ORDER BY forumid,lastpost DESC";
Is that enough to get you started?
thanks...
I'll have to spend more time getting into php... been so long with perl... trying to do too much too soon I guess.
Overgrow
05-04-2001, 08:43 PM
I started with PERL and went to PHP after a year or so (same reason, UBB to VB). It's SO MUCH NICER when programming for the web. Get into it, you won't regret it. I'll break this down a bit for you..
$startToday?=?strtotime(date("m/d/y",time()));
strtotime is a built in PHP function, if you ever wonder if something is built in and what it does, go to
www.php.net/strtotime
or whatever the function name is, and you will get the info.
date is also a built in php function, as well as time...
Bascially I'm pulling the current timestamp with time(), formatting it with date, and then translating that BACK into a timestamp with strtotime. The key there is that when I do the first conversion, I don't use the hour:minutes so eventually it returns the timestamp of TODAY at 12:01 AM.
After that, I add 86400 seconds to it to make the endToday timestamp = tomorrow.
Then I build the SQL query.. After you finish writing the query, do something like
$results = mysql_query($query,$db_connection);
while ( $row = mysql_fetch_array ( $results ) ) {
print "<a href=\"showthread.php?threadid=$row[threadid]\">$row[title]</a>";
}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.