EZ Crisis: Phase 2

Most popular columns

// maximum number of items to show:
$count = 30;
$term_id = 2277;

$popular = db_query_range("SELECT n.nid, n.title, n.type, ncount.totalcount
FROM {node} n
INNER JOIN {term_node} term ON n.nid = term.nid
INNER JOIN {node_counter} ncount ON n.nid = ncount.nid
WHERE term.tid = 2277 AND
n.status = 1
AND
n.created > 1309478400
ORDER BY ncount.totalcount DESC",$term_id,0,$count);

while ($node = db_fetch_object($popular)) {
if ($node->type == "talk") {
$pitems[] = l($node->title, 'node/'. $node->nid) . " (" . $node->totalcount . ")" . " ";
} else {
$pitems[] = l($node->title, 'node/'. $node->nid) . " (" . $node->totalcount . ")";
}
}
$poutput = theme('item_list', $pitems);
print $poutput;
?>

 

Most recent columns

// maximum number of items to show:
$count = 30;
$term_id = 2277;

$recent = db_query_range("SELECT n.nid, n.title, n.type, ncount.totalcount
FROM {node} n
INNER JOIN {term_node} term ON n.nid = term.nid
INNER JOIN {node_counter} ncount ON n.nid = ncount.nid
WHERE term.tid = 2277 AND
n.status = 1
AND
n.created > 1309478400
ORDER BY n.created DESC",$term_id,0,$count);

while ($node = db_fetch_object($recent)) {
if ($node->type == "talk") {
$ritems[] = l($node->title, 'node/'. $node->nid) . " ";
} else {
$ritems[] = l($node->title, 'node/'. $node->nid);
}
}
$routput = theme('item_list', $ritems);
print $routput;
?>

Events