last changes
[ayans.git] / archives.php
blob48a7761d57d4a3dc11b21a3a0a2cdfe2a2e3c97d
1 <?php
3 require 'includes/config.inc.php';
4 require INCLUDES_PATH.'prepend.php';
5 require INCLUDES_PATH.'paginate.php';
7 try {
8 $pdo = new PDO(DBH);
9 } catch (PDOException $e) {
10 die("pdo error: ".$e->getMessage());
13 $tpl = new templates();
15 $tpl->addFile('_begin','header.tpl.php');
16 $tpl->addFile('_end','footer.tpl.php');
17 $tpl->addFile('archives','archives.tpl.php');
19 $tpl->title = "AYANS archives";
21 $news = new news_node();
22 $news->setPDO($pdo);
23 $news->setView(news_node::ARCHIVE_VIEW);
24 $news->add_filter('Markdown','text');
26 // Comment this if you have some charset problems
27 $news->add_filter('utf8_decode','title');
29 $news->add_filter('htmlentities','title');
30 $news->add_filter('set_bolder','author');
32 $dq = $pdo->query('SELECT COUNT(*) as elems FROM news');
33 $num = $dq->fetch(PDO::FETCH_ASSOC);
34 $pages = new paginate($num['elems'],20);
36 $tpl->content = $news->render((isset($_GET['reload']) ? true : false),$pages);
39 $tpl->render('archives');