druapl显示每个用户的文章数
来源: 作者: 发布日期:2008-07-17 浏览次数:
- <?php
- $how_many_per_page = 100;
- $query = "SELECT {node}.created AS Date, name, type, COUNT(*) AS Total
- FROM {node} JOIN {users}
- ON {node}.uid = {users}.uid
- GROUP BY FROM_DAYS(TO_DAYS(FROM_UNIXTIME({node}.created))), name, type";
- $count = "SELECT COUNT(*) FROM (SELECT DISTINCT FROM_DAYS(TO_DAYS(FROM_UNIXTIME({node}.created))) AS DATE, uid, type FROM {node}) AS Data_row";
- $results = pager_query($query, $how_many_per_page, 0, $count);
- $header = array(t('Date'), t('Name'), t('Type'), t('Total'));
- $attributes = array('width' => '75%',
- 'align' => 'center',
- 'border' => '2',
- );
- $rows = array();
- while ($quote = db_fetch_array($results)) {
- $rows[] = array(date('Y/m/d',$quote['Date']), $quote['name'], $quote['type'], $quote['Total']);
- }
- if (count($rows)) {
- echo theme('table', $header, $rows, $attributes);
- echo theme('pager', NULL, $how_many_per_page);
- }
- else { echo 'No results found'; }
- ?>
使用版本:Drupal 5.X
关键词:
- 上一篇:Drupal theme - Hammerhead
- 下一篇:


