Eneko Alonso

un Navarro en California

Projects

¿Eres español y vives fuera de España? ¿Estás pensando en salir una temporada a trabajar o estudiar en el extranjero? Si es así, no dejes de visitar Spaniards.es, la Comunidad de Españoles en el Mundo
spaniards.es

Recent comments

17:12 America/Los_Angeles


Most readed content on your Drupal website

Sometimes people ask me about some stuff I have done on my Drupal sites, like this blog or Spaniards.es. I was just updating the Popular items page and I thought it would be nice to paste the code here. After all, is very simple, but still it may help newbies :)

<?php $sql = "select n.title, n.nid, nc.totalcount, n.created from node n join node_counter nc on n.nid = nc.nid where n.type = 'story' order by nc.totalcount desc limit 0,100"; $result = db_query($sql); $output = ''; while ($anode = db_fetch_object($result)) { $output .= "" . date('M d, y', $anode->created) . " " . l($anode->title, "node/$anode->nid") . " ($anode->totalcount reads)
"; } print "
$output
"; ?>

PS: This doesn't follow Drupal's standards.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.