public static function getMainStories($amt) {
global $db, $tpl, $light;
if($r = $db->query("SELECT id,title,topstory_image,snippet FROM site_news ORDER BY id DESC LIMIT " . $amt . "")) {
$c = 0;
while($a = $r->fetch_assoc()) {
$disp = 'block';
$imgurl = $a['topstory_image'];
if($c > 0) { $disp = 'none'; }
$_seo = $a['id'] . "-" . strtolower(str_replace(strip_tags(' ', '-', $a['title'])));
echo '<div class="topstory" style="background-image: url(' . $imgurl . '); display: ' . $disp . ';">
<h4>Latest news</h4>
<h3><a href="' . WWW . '/articles/' . $_seo . '">' . $light->filter(strip_tags($a['title'])) . '</a></h3>
<p class="summary">
' .$light->filter(strip_tags($a['snippet'])) . '
</p>
<p>
<a href="' . WWW . '/articles/' . $_seo . '">Read more »</a>
</p>
</div>';
$c++;
}
echo '<div id="topstories-nav" style="display: none"><a href="#" class="prev">« Previous</a><span>1</span> / ' . $c . '<a href="#" class="next">Next »</a></div>';
}
else {
$db->databaseError($db->error);
}
}