'.$years[year].': '); $qm = mysql_query("SELECT distinct month(post_date) as month FROM $tableposts ORDER BY month asc") or die(mysql_error()); while($date = mysql_fetch_array($qm)) { $q = mysql_query("SELECT *, year(post_date) as year, month(post_date) as month FROM $tableposts WHERE year(post_date)='$years[year]' AND month(post_date)='$date[month]' AND post_status='publish' AND post_date <= NOW() ORDER BY id desc") or die(mysql_error()); $sm = ucfirst(strftime("%b", strtotime("$date[month]/01/2001"))); // get the shortened month name; strtotime() localizes $pd = sprintf("%02s", $date[month]); // pad the month with a zero if needed if(mysql_num_rows($q)) { echo(''.$sm.' '); } else { if ($sm == "Dec") { if ($smPrev == "Nov") { echo(''.$sm.' '); } } else { echo(''.$sm.' '); } } $smPrev=$sm; } echo('
'); } echo ('

'); } if (($format == 'both') || ($format == 'list')) { //check to see if we are supposed to display the list $qy = mysql_query("SELECT distinct year(post_date) as year, post_status FROM $tableposts WHERE post_status='publish' AND post_date <= NOW() ORDER BY year desc"); // loop to display links to all posts, sorted by descending month and day while($years = mysql_fetch_array($qy)) { $qm = mysql_query("SELECT distinct month(post_date) as month FROM $tableposts ORDER BY month desc") or die(mysql_error()); while($date = mysql_fetch_array($qm)) { $q = mysql_query("SELECT *, year(post_date) as year, month(post_date) as month FROM $tableposts WHERE year(post_date)='$years[year]' AND month(post_date)='$date[month]' AND post_status='publish' AND post_date <= NOW() ORDER BY id desc") or die(mysql_error()); if(mysql_num_rows($q)) { $lm = ucfirst(strftime("%B", strtotime("$date[month]/01/2001"))); // get the full month name; strtotime() localizes $pd = sprintf("%02s", $date[month]); // pad the month with a zero if needed echo('

'.$lm.' '.$years[year].'

'); echo('
'); } } } } } ?>