Text Formatted Code
function COM_featuredCheck()
{
global $_TABLES;
// Look for multiple featured frontpage articles. If more than one pick the newest.
$sql = "SELECT sid FROM {$_TABLES['stories']} WHERE featured = 1 AND draft_flag = 0 AND frontpage = 1 AND date <= NOW() ORDER BY date DESC LIMIT 2";
$resultB = DB_query($sql);
$numB = DB_numRows($resultB);
if ($numB > 1) {
$B = DB_fetchArray($resultB);
// un-feature all other featured frontpage story
$sql = "UPDATE {$_TABLES['stories']} SET featured = 0 WHERE featured = 1 AND draft_flag = 0 AND frontpage = 1 AND date <= NOW() AND sid <> '{$B['sid']}'";
DB_query($sql);
}
I have multiple topics and each topic has one featured article. The code above allows one featured article and delete the other featured flags through all topics.
Is this how it works?