Location: PHPKode > projects > Backend code/CMS for blizzle.com > v1.x/giblets/sitelinks.php
<?

$dateW = getdate(time()-604800); 
$lastWeek = date("Y-m-d H:i:s", mktime($dateW['hours'],$dateW['minutes'],$dateW['seconds'],$dateW['mon'],$dateW['mday'],$dateW['year']));

$bHtml = "";

$query = "CREATE TEMPORARY TABLE tmpitem_headers SELECT itemID, itemDate, itemCategory FROM item_headers WHERE itemDate > '$lastWeek';";
$result = mysql_query ($query, $link) or die (mysql_error());

$query = "SELECT categories.*, Count(tmpitem_headers.itemID) FROM categories LEFT JOIN tmpitem_headers ON categories.categoryName = tmpitem_headers.itemCategory GROUP BY categories.categoryName ORDER BY categoryName;";


$result = mysql_query ($query, $link) or die (mysql_error());
$bHtml = "<a class=giblet href=\"/index.php\">home</a><p>\n";
while (list($catID,$catName,$catNumber) = mysql_fetch_row($result)) {
$catNum = $catNumber+$catNum;
if ($catNumber > 0) {
	$bHtml = $bHtml."<a class=giblet href=\"/index.php?category=$catName\">$catName</a> <font size=-2>($catNumber)</font><br>\n";
} else {
	$bHtml = $bHtml."<a class=giblet href=\"/index.php?category=$catName\">$catName</a><br>\n";
}
}

$bHtml = $bHtml."<p><font size=-2>($catNum new since last week)</font>";

createGiblet('categories',$bHtml);

?>
Return current item: Backend code/CMS for blizzle.com