Most popular blog entries

20 most popular entries in this blog, based on data from the statistics module. And, of course, the code to build such a list.

Daily hitsTotal hitsPost title
301734Checkboxes in forms step by step
2113725Customizing the Internet Keyboard 350 multimedia player key
21404If the SELECT in your Drupal modules are suddenly all 4 lines high or more...
192838Spaces in PHP variable names
17848Reducing system load for graphical widgets
17866A graphical progress bar widget for FormsAPI
16876A progress bar widget for FormsAPI
114719Formatting PHP code in Eclipse PDT and Zend Neon
11775Grokking Drupal: module dependencies in e-Commerce 4
104649Creating Google Gadgets within Drupal
105356SOAP box: accessing VIES from PHP-GTK
92523Multisite and dynamic configuration items in Drupal : help from Apache
92182Drupal security from the outside
89519Grokking Drupal : e-Commerce
83197When Drupal 6.x dev always returns "page not found"... pages can still be found
87772Drupal coder: writing a Drupal XML-RPC service
76507Data Model for Drupal 4.7 core
71154Deprecating img_relocator
74831Live graphical stats for php-gtk.eu with Drupal
75008Console encoding in PHP-GTK apps

Lament

Looks like my drupal posts are more popular than my music-related ones :-(

Gimme the code !

In case you'd wonder how to get to these results, here is the code used:

drupal_set_html_head('<style type="text/css">.num { text-align: center; padding: 0 1em ; }</style>');
$limit = 20;
$header = array ('Daily hits', 'Total hits', 'Post title');
$sq = 'SELECT nc.totalcount cnt, 86400 * nc.totalcount / (UNIX_TIMESTAMP() - n.created) daily, '
    . 'n.nid nid, n.title title '
    . 'FROM {node_counter} nc '
    . '  INNER JOIN {node} n ON n.nid = nc.nid '
    . 'ORDER BY 2 DESC, 1 DESC ';
$q = db_query_range($sq, 0, $limit);
$data = array();
while ($o = db_fetch_object($q))
  {
  $data[] = array(
    array(
      'data'  => round($o->daily), 
      'class' => 'num'
      ),
    array(
      'data'  => $o->cnt, 
      'class' => 'num',
      ),
    l($o->title, "node/$o->nid"));
  }

$ret = theme_table($header, $data);
echo $ret;