[Comoblog-commit] modules/mod_postbydate/include mod_postbydate.inc.php,NONE,1.1
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2005-11-27 19:58:54
|
Update of /cvsroot/comoblog/modules/mod_postbydate/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9857/mod_postbydate/include Added Files: mod_postbydate.inc.php Log Message: initial add, just to make sure ive got the hang of it. mod_postbydate ,builds a select box or list of posts by month, clicking on a link in it takes you to the first date with posts in that month, Its all working for me, but feel free to provide feed back. (and thanks to all of you whole helped test it, it now supports any language via the admin area, see the welsh sql file in the root of this module if your updating Oh and it really needs its own icon I suppose - but I'm not good at that, I'm open to suggestions --- NEW FILE: mod_postbydate.inc.php --- <?php function mod_postbydate_list () { // a fake one to make counting easier $months = array("no month", CFG_POSTBYDATE_MONTH_01, CFG_POSTBYDATE_MONTH_02, CFG_POSTBYDATE_MONTH_03, CFG_POSTBYDATE_MONTH_04, CFG_POSTBYDATE_MONTH_05, CFG_POSTBYDATE_MONTH_06, CFG_POSTBYDATE_MONTH_07, CFG_POSTBYDATE_MONTH_08, CFG_POSTBYDATE_MONTH_09, CFG_POSTBYDATE_MONTH_10, CFG_POSTBYDATE_MONTH_11, CFG_POSTBYDATE_MONTH_12); $query = "select count(*) as postcount , FROM_UNIXTIME(post_mail_date, '%b %Y') as yearmonth, FROM_UNIXTIME(post_mail_date, '%c') as justmonth , FROM_UNIXTIME(post_mail_date, '%Y') as justyear, min(FROM_UNIXTIME(post_mail_date,'%Y%m%d')) as posturl from ".CFG_MYSQL_TABPREFIX."posts group by yearmonth order by post_mail_date desc , posturl asc"; $res = mysql_query($query); if (!$res || !mysql_num_rows($res)){ return (false); } $items = array(); while ($row = mysql_fetch_assoc($res)) { $row['monthword'] = $months[$row['justmonth']]; $items[] = $row; } return ($items); } ?> |