<?
//Get the web links sort them according to popularity
$query = "SELECT link_id FROM tblLink ORDER BY link_visits DESC";
$result = $db->doQuery($query);
while($row = $result->getArray())
{
$link = new Link($db, $row['link_id']);
$links[] = array('id' => $link->getId(),
'name' => $link->getName(),
'url' => $link->getUrl(),
'visits' => $link->getVisits());
}
$template->assign('links', $links);
//Get the Previous Articles to display
$limit = "LIMIT " . $config['num_articles'] . ", " . $config['num_previous'];
$query = "SELECT article_id FROM tblArticle ORDER BY article_id DESC $limit";
$result = $db->doQuery($query);
while($row = $result->getArray())
{
$article = new Article($db, $row['article_id']);
$articles_old[] = array('id' => $article->getId(),
'title' => $article->getTitle(),
'numComments' => $article->getNumComments());
}
$template->assign('articles_old', $articles_old);
//Lets display the template
$template->display($config['theme'].'/footer.tpl');
?>