In PHP-Nuke 5, you can have the Old Articles block, but it defaults to the last x days that you have showing on your homepage. Does anybody know of any blocks that let you show only a limited number of days?
For example, this site has the last 5 days of old articles, even though the main page shows 10 articles...
If you would like to limit the old articles by the date age, in addition to the number of articles controlled by the Preferences setting, try this.
Find these lines in blocks/block-Old_Articles.php
Code:
$sql = "SELECT sid, title, time, comments FROM ".$prefix."_stories $querylang ORDER BY time DESC LIMIT $storynum, $oldnum";
Try changing them to this.
Code:
define("_CUTOFFDAYS",60);
$cutoffDate = time()-(_CUTOFFDAYS*86400);
if (isset($cutoffDate)) $querylang .= " AND (unix_timestamp(time) >= $cutoffDate)";
$sql = "SELECT sid, title, time, comments FROM ".$prefix."_stories $querylang ORDER BY time DESC LIMIT $storynum, $oldnum";
The '60' is 60 days. Make it whatever you want. Let me know if this works or not.
Hehehe, yeah, if you read that full thread, Raven wrote the code for me...unfortunately, for some odd reason it doesn't work for my system.
The only thing we could figure out (I runn IIS 5.0, PHP-Nuke 6.5) is that it has something to do with the %T parameter in PHP not working on my setup. When I post news stories and use the %T option in the lang-english file for the dates, it coms up blank...I end up having to use %I%M %p parameters.
Was hoping somebody had a different suggestions.
What block does this site use? It isn't the default Old Articles block, so was just wondering...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum