Skip to content

Commit

Permalink
Module/News: Fix rss view
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightprince committed Apr 23, 2024
1 parent 17f13b4 commit b6b4216
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions application/modules/news/controllers/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,21 @@ public function rss()
{
$this->news_articles[$key]['title'] = xml_convert(langColumn($article['headline']));
$this->news_articles[$key]['content'] = xml_convert(langColumn($article['content']));
$this->news_articles[$key]['link'] = base_url().'news/view/'.$article['id'];
$this->news_articles[$key]['link'] = base_url() . 'news/view/'.$article['id'];
$this->news_articles[$key]['date'] = date(DATE_RSS, $article['timestamp']);
$this->news_articles[$key]['author'] = $this->user->getNickname($article['author_id']);
$this->news_articles[$key]['tags'] = $this->news_model->getTags($article['id']);
}

$data['link'] = $this->config->site_url();
$data['domain'] = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
$data['feed_url'] = base_url().'news/rss';
$data['domain'] = $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'];
$data['feed_url'] = base_url() . 'news/rss';
$data['page_description'] = $this->config->item('rss_description');
$data['page_language'] = $this->config->item('rss_lang');
$data['articles'] = $this->news_articles;

header('Content-Type: text/xml; charset=UTF-8');
echo $this->template->loadPage('rss.tpl', $data);
die($this->template->loadPage('rss.tpl', $data));
}

private function displayPage()
Expand Down
40 changes: 20 additions & 20 deletions application/modules/news/views/rss.tpl
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{literal}<?xml version='1.0' encoding='utf-8'?>{/literal}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{$domain}</title>
<link>{$link}</link>
<description>{$page_description}</description>
<language>{$page_language}</language>
<category domain="{$domain}">NewsFeed</category>
<generator>{$domain} Site</generator>
<docs>http://www.rssboard.org/rss-specification</docs>
<atom:link href="{$feed_url}" rel="self" type="application/rss+xml" />
{foreach from=$articles item=article}
<item>
<guid isPermaLink='false'>{$article.id}</guid>
<link>{$article.link}</link>
<title>{$article.title}</title>
<author>{$article.author}</author>
<description>{$article.content}</description>
<pubDate>{$article.date}</pubDate>
</item>
{/foreach}
</channel>
<channel>
<title>{$domain}</title>
<link>{$link}</link>
<description>{$page_description}</description>
<language>{$page_language}</language>
<category domain="{$domain}">NewsFeed</category>
<generator>{$domain} Site</generator>
<docs>http://www.rssboard.org/rss-specification</docs>
<atom:link href="{$feed_url}" rel="self" type="application/rss+xml"/>
{foreach from=$articles item=article}
<item>
<guid isPermaLink='false'>{$article.id}</guid>
<link>{$article.link}</link>
<title>{$article.title}</title>
<author>{$article.author}</author>
<description>{$article.content}</description>
<pubDate>{$article.date}</pubDate>
</item>
{/foreach}
</channel>
</rss>

0 comments on commit b6b4216

Please sign in to comment.