| 5 statistics.module | statistics_title_list($dbfield, $dbrows) |
| 6 statistics.module | statistics_title_list($dbfield, $dbrows) |
| 7 statistics.module | statistics_title_list($dbfield, $dbrows) |
| 8 statistics.module | statistics_title_list($dbfield, $dbrows) |
Returns all time or today top or last viewed node(s).
Parameters
$dbfield: one of
- 'totalcount': top viewed content of all time.
- 'daycount': top viewed content for today.
- 'timestamp': last viewed node.
$dbrows: number of rows to be returned.
Return value
A query result containing n.nid, n.title, u.uid, u.name of the selected node(s) or FALSE if the query could not be executed correctly.
1 call to statistics_title_list()
File
- modules/
statistics/ statistics.module, line 267 - Logs access statistics for your site.
Code
function statistics_title_list($dbfield, $dbrows) {
if (in_array($dbfield, array('totalcount', 'daycount', 'timestamp'))) {
$query = db_select('node', 'n');
$query->addTag('node_access');
$query->join('node_counter', 's', 'n.nid = s.nid');
$query->join('users', 'u', 'n.uid = u.uid');
return $query
->fields('n', array('nid', 'title'))
->fields('u', array('uid', 'name'))
->condition($dbfield, 0, '<>')
->condition('n.status', 1)
->orderBy($dbfield, 'DESC')
->range(0, $dbrows)
->execute();
}
return FALSE;
}
Login or register to post comments