Files
scummvm-web/include/Pages/FeedsPage.php
T
Matan Bareket 95aaec5f3e WEB: Use AltoRouter instead of apache rewrites
This makes debugging and using other web servers much easier, and scales better when adding functionality and pages
2019-04-24 20:57:03 -04:00

42 lines
928 B
PHP

<?php
namespace ScummVM\Pages;
use ScummVM\Controller;
use ScummVM\Models\NewsModel;
class FeedsPage extends Controller
{
private $template_rss;
private $template_atom;
/* Constructor. */
public function __construct()
{
parent::__construct();
$this->template_rss = 'pages/feed_rss.tpl';
$this->template_atom = 'pages/feed_atom.tpl';
}
/* Display the index page. */
public function index($args)
{
$feed = $args['type'];
if ($feed == 'atom') {
$template = $this->template_atom;
} else {
$template = $this->template_rss;
}
$news_items = NewsModel::getLatestNews(NEWS_ITEMS, true);
header('Content-Type: text/xml; charset=UTF-8');
print $this->fetch(
$template,
array(
'news' => $news_items,
)
);
return true;
}
}