Quote:
Originally Posted by LPH2004
This is gorgeous but how do I only get 2 days worth ... and not a whole HUGE string of days ... ?
I'm installing it on www.whatisnew.com
|
The last part of the newsdigest.php file is the looks like this.
PHP Code:
if ($vba_options['portal_news_forumid'])
{
$timespan = 'thread.dateline>UNIX_TIMESTAMP(CURDATE())';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-1)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-1) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-2)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-2) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-3)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-3) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-4)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-4) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-5)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-5) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-6)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-6) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-7)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-7) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-8)';
construct_newsdays();
}
The first line checks for any news posts made prior to the current date in case there's a glitch in the timestamp of the news item that puts it in the future it will still display. Each line that follows is one day. So, simply trim it down to the number of desired iterations. Two days would read...
PHP Code:
if ($vba_options['portal_news_forumid'])
{
$timespan = 'thread.dateline>UNIX_TIMESTAMP(CURDATE())';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-1)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-1) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-2)';
construct_newsdays();
}
I've tried a couple of times now to get this to work as a while loop but so far nothing gets displayed when I try it that way