// select all news articles ordered by year and month
$query = "SELECT DATE_FORMAT((FROM_UNIXTIME(node.created) + INTERVAL 3600 SECOND),'%Y%m%d %M')
AS created_year_month, node.nid
FROM node node
INNER JOIN term_node term_node ON node.nid = term_node.nid
WHERE ( node.status <>0)
AND ( node.type IN ( 'info_page'))
AND ( term_node.tid = 68)
AND ( node.created <= NOW( ) +60)
ORDER BY created_year_month DESC";
$rst = mysql_query($query);
$prev_year = "";
$prev_month = "";
if ($rst)
{
// loop through each and check on year and month changes
print "
\n";
$prev_year = $n_year;
$prev_month = "";
$year_zebra = ($year_zebra == 'even') ? 'odd' : 'even';
print "\n";
$c_class='head first';
while ($row = mysql_fetch_array($rst))
{
$n_date = $row['created_year_month'];
$n_year = substr($n_date,0,4);
$n_month = substr($n_date,9);
$n_day = substr($n_date,4,2);
$n_dstr = $n_day . " " . $n_month . " " . $n_year;
$n_nid = $row['nid'];
$n_node = node_load($n_nid);
$n_title = strip_tags(html_entity_decode($n_node->title));
$n_ipath = $n_node->field_middle_image[0]['filepath'];
$n_image = theme('imagecache','news_image', strip_tags($n_ipath), '','','');
$n_head = strip_tags(html_entity_decode($n_node->field_body_0[0]['value']));
$n_url = drupal_get_path_alias('node/'.$n_nid);
$para = substr(strip_tags($n_node->field_body_detail[0]['value']),0, 300);
$cut = strrpos($para," ");
$n_body = substr($para,0,$cut);
//output year if different
if (0 != strcmp($n_year,$prev_year))
{
if ($prev_year) print "