newsTypeID; // create our title $pageTitle = ($newsdb != 1) ? ucwords($newsType->typeName) ." News" : "News"; //Instantiate the page class $page = new page($pageTitle); defaultFeatures(&$page); //Find out how many seconds are in a week. :) $week = 60 * 60 * 24 * 7; //Clean up any posts older than a week mysql_query("UPDATE news SET archived = 1 WHERE newsDate < '". date('Y-m-d H:i:s', time() - $week) ."';") or die(mysql_error()); //Grab any active news posts $result = mysql_query("SELECT newsIcon, newsHeadline, newsPost, userID, DATE_FORMAT(newsDate, '%W, %M %e %Y') AS date, DATE_FORMAT(newsDate, '%r') AS time FROM news WHERE archived = 0 AND newsTypeID = $newsdb ORDER BY newsDate DESC"); while($curPost = mysql_fetch_object($result)) { //check to see if we changed days if($postDay != $curPost->date) { //If there is currently a table we are in... if($table) $page->addContent("$postDay", $table->writeTable()); //Assign current date $postDay = $curPost->date; //Create a table for displaying the news posts $table = new datatable(); $table->initTable(1, '100%', 'center'); $table->setBGColors('#034981', '#02355E', '#023D6C'); } // format any URL's in the body of the post $newsPost = parseTags($curPost->newsPost, "news"); //grab the poster info $posterInfo = mysql_fetch_object(mysql_query("SELECT userName, userID FROM users WHERE userID = $curPost->userID")); $table->newRow(); $table->addData(1, "
newsIcon\" align=\"left\">$curPost->newsHeadline
Posted By: userID\">$posterInfo->userName
$curPost->time
$newsPost
"); } //Loops is done, print the final days postings, assuming there were some.. if($table) { $page->addContent("$postDay", $table->writeTable()); } print($page->writePage()); //Close the DB connection closeDB(); ?>