Posted on: 06/17/04 10:02am
By: Euan
if ($newstories) { $sql .= "AND (date >= (date_sub(NOW(), INTERVAL {$_CONF['newstoriesinterval']} SECOND))) "; } // new from here if (($_CONF['featured_only'] == 1) && !($page == 1)) { $offset = 1 + (($page - 2) * $limit); } else { $offset = ($page - 1) * $limit; } $sql .= "ORDER BY featured DESC, date DESC"; $result = DB_query ("SELECT *,UNIX_TIMESTAMP(date) AS day " . $sql . " LIMIT $offset, $limit"); $nrows = DB_numRows ($result); $data = DB_query ("SELECT COUNT(*) AS count " . $sql); $D = DB_fetchArray ($data); if ($_CONF['featured_only'] == 1) { $num_pages = 1 + (ceil (($D['count']-1) / $limit)); } else { $num_pages = ceil ($D['count'] / $limit); } if ($nrows > 0) { for ($x = 1; $x <= $nrows; $x++) { $A = DB_fetchArray($result); if ($A['featured'] == 1) { $feature = 'true'; } elseif (($x == 1) && ($_CONF['showfirstasfeatured'] == 1)) { $feature = 'true'; $A['featured'] = 1; } $display .= COM_article($A,'y'); if ($A['featured'] == 1) { $display .= PLG_showCenterblock (2, $page, $topic); } if ($_CONF['featured_only'] == 1 && $feature) { break; } } // new up to here $display .= PLG_showCenterblock (3, $page, $topic); // bottom blocks
$_CONF['featured_only'] = 1; // set to 1 to show only the featured article on the top page when a featured article exists