<?php
    //-------------------------------------------------------------------
    // m_categories
    // display blog entry archives by category
    //-------------------------------------------------------------------
   
    drawMenuTop('Categories');
     
    global $siteSettings;
    //
    //TODO: probably a lot of optimization can be done to the whole 'archives' system
    //
    $categories = mysql_query("SELECT DISTINCT category FROM blog") or die(mysql_error() );
     
     
    while ($row = mysql_fetch_array($categories) )
    {
        if ($row['category'] == '' )
            $cat = 'Unfiled';
        else
            $cat = $row['category'];
         
         
         
        if ($siteSettings['slickurls'] == TRUE )
            print("<a href='" . $siteSettings['siteurl'] . "/category/$cat'>" . $cat . "</a><br />");
        else
            print("<a href='index.php?shard=blog&amp;action=g_category&amp;category=$cat'>" . $cat . "</a><br />");
    }
     
     
     
    drawMenuBottom();
     
     
?>
