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

10:58 America/Los_Angeles


Drupal Archive

I wanted to have a very simple archive page for my blog, but I didn't want to install any extra modules. So I just wrote this code:

<?php $sql = "select n.title, n.nid, n.created, n.* from node n where n.type = 'story' and n.status = 1 order by n.created desc"; $result = db_query($sql); $output = ''; $anode = db_fetch_object($result); while ($anode) { $current_month = date('F', $anode->created); $output .= "

$current_month " . date('Y', $anode->created) . "

\n"; $output .= "
    \n"; do { $output .= "
  • " . date('d', $anode->created) . " " . l($anode->title, "node/$anode->nid") . "
  • "; } while (($anode = db_fetch_object($result)) && (date('F', $anode->created) == $current_month)); $output .= "
\n"; } print $output; ?>

You can see the result here.

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.