Basically, I want a news page with Archives list in the side column based on the month and year.. for example June 2012. The table is named 'news', with columns news_id, news_title, news_entry, updated, created. Updated and created are timestamps. Right now I am using normal php as below:
mysql_select_db($database_admin_conn, $admin_conn);
$query_getArchives = "SELECT DISTINCT DATE_FORMAT (news.updated, '%M %Y') AS archive, DATE_FORMAT (news.updated, '%Y-%m') AS link FROM news ORDER BY news.updated DESC";
$getArchives = mysql_query($query_getArchives, $admin_conn) or die(mysql_error());
$row_getArchives = mysql_fetch_assoc($getArchives);
$totalRows_getArchives = mysql_num_rows($getArchives);
Code to display archives column is as below:
<h3>News Archives</h3>
<ul>
<?php do { ?>
<li class="seperator
<?php echo (isset($_GET['archive']) && $_GET['archive'] == $row_getArchives['link'] ? 'currentItem' : '') ?>">
<a href="news.php?archive=<?php echo $row_getArchives['link']; ?>"><?php echo $row_getArchives['archive']; ?></a>
</li>
<?php } while ($row_getArchives = mysql_fetch_assoc($getArchives)); ?>
</ul>
How do I realise the select statement in the first block of code in Zend Framework, to achieve the same result as the present code output? Thanks in advance!