function _package_block_category_news_helper($tid, &$used_nids, $count = 5, $orders = 'sticky DESC, changed DESC', $fields = '') {
$stories = array();
$result = db_query_range("
SELECT DISTINCT nid, sticky, title, created $fields
FROM {node_tag_score}
WHERE tid IN ('%d')
AND nid NOT IN (%s)
ORDER BY $orders", $tid, implode(', ', $used_nids), 0, $count);
while($story = db_fetch_object($result)) {
if(!in_array($story->nid, $used_nids) && count($stories) < 5) {
$stories[] = node_load($story->nid);
$used_nids[] = $story->nid;
}
}
return $stories;
}
Advertisement
Tags: Tech & Biz
No comments:
Post a Comment