function featured_content_get_nodes in Featured Content 6
Same name and namespace in other branches
- 6.2 featured_content.module \featured_content_get_nodes()
- 7.2 featured_content.module \featured_content_get_nodes()
- 7 featured_content.module \featured_content_get_nodes()
Gets nodes from nids.
1 call to featured_content_get_nodes()
- featured_content_view in ./
featured_content.module - Provides 'view' info for hook_block().
File
- ./
featured_content.module, line 987 - Featured Content module for created related & featured content blocks.
Code
function featured_content_get_nodes($nids, $sort) {
if (!empty($nids)) {
$nodes = array();
// use node_counter if sorting by popularity and counts are available
$totalcount_select = $totalcount_inner_join = '';
if (($sort == 'popular_desc' || $sort == 'popular_asc') && featured_content_node_statistics_enabled()) {
$totalcount_select = ', nc.totalcount ';
$totalcount_inner_join = ' INNER JOIN {node_counter} AS nc ON n.nid=nc.nid ';
}
$results = db_query(db_rewrite_sql('SELECT n.nid, n.title, n.created, n.type ' . $totalcount_select . ' FROM {node} AS n ' . $totalcount_inner_join . ' WHERE n.nid IN (' . db_placeholders($nids, 'int') . ') AND n.status <> 0'), $nids);
while ($node = db_fetch_object($results)) {
if ($totalcount_select == '') {
$node->totalcount = 1;
// treat all nodes equally for sort purposes
}
$nodes[$node->nid] = $node;
}
return $nodes;
}
}