[Comoblog-commit] modules/mod_postbytopic/include mod_postbytopic.inc.php,NONE,1.1
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2005-11-28 11:13:23
|
Update of /cvsroot/comoblog/modules/mod_postbytopic/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19872/mod_postbytopic/include Added Files: mod_postbytopic.inc.php Log Message: initial add, mod_postbytopic, builds a select box or list of posts by topic with a count, clicking on a link, takes you to the posts MARK - may need the iis stuff adding --- NEW FILE: mod_postbytopic.inc.php --- <?php function mod_postbytopic_list () { // this bit needs fixing - we shouldnt have to exclude the posts that have no topic, // but we cant return a NULL or 0 topic id so I've excluded it for now // see the replacements section below to see what i *wanted* to do // we need to be able to use 0 in topic.php to gt a list of posts that arn't assigned to any category $query = "select count(*) as post_count , t.topic_name, t.topic_id ,t.topic_description from ".CFG_MYSQL_TABPREFIX."posts p left join ".CFG_MYSQL_TABPREFIX."topics t on p.topic_id = t.topic_id where p.topic_id >0 group by 2 order by 2;"; $res = mysql_query($query); if (!$res || !mysql_num_rows($res)) return (false); $items = array(); while ($row = mysql_fetch_assoc($res)) { if ($row['topic_name'] == "" ){$row['topic_name'] = "unassigned" ; } if ($row['topic_name'] == "NULL" ){$row['topic_name'] = "unassigned" ; } if ($row['topic_description'] == "" ){$row['topic_description'] = "unassigned" ; } if ($row['topic_description'] == "NULL" ){$row['topic_description'] = "unassigned" ; } // need to find a better way to do this one - we get a 404 even if we use 0 // so I've excluded it from the select above // we need to be able to use 0 in topic.php to gt a list of posts that arnt assigned to any category // if ($row['topic_id'] == "" ){$row['topic_id'] = "1" ; } // if ($row['topic_id'] == "NULL" ){$row['topic_id'] = "1" ; } $items[] = $row; } return ($items); } ?> |