Location: PHPKode > projects > Horizon Blogging Software > archives.php
<?php
$time_start = microtime(TRUE);

define('IN_HBS',TRUE);

include('inc/include.php');
$cfg = getConfig();

$vars['config'] = $cfg;
$vars['title'] = $cfg['hzn_title'];
show_page('header',$vars,$cfg['template']);

db();

$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%Y' ) AS get_year, COUNT(*) AS entries FROM " . $mysql["db_prefix"] . "main GROUP BY get_year");

while ($row = mysql_fetch_array($result))
{
	$get_year = $row['get_year'];
	$entries = $row['entries'];
	$vars['get_year'] = $get_year;
	$vars['entries'] = $entries;
	$vars['list'] = TRUE;
   	show_page('archive',$vars,$cfg['template']);
}


if (isset($_GET['year']))
{
	$year = (int)$_GET['year'];
	$result = mysql_query("SELECT timestamp, id, title FROM " . $mysql["db_prefix"] . "main WHERE FROM_UNIXTIME( timestamp, '%Y' ) = '$year' ORDER BY id DESC");
	while ($row = mysql_fetch_array($result))
	{
		$date = date("l F d Y", $row['timestamp']);
		$id = $row['id'];
		$title = stripslashes($row['title']);
		$vars['date'] = $date;
		$vars['id'] = $id;
		$vars['title'] = $title;
		show_page('archive',$vars,$cfg['template']);
	}
}

$vars['version'] = getVersion();
show_page('footer',$vars,$cfg['template']);
$time_end = microtime(TRUE);
$time = $time_end - $time_start;
echo $time;
?>
Return current item: Horizon Blogging Software