A
A
Anton2015-07-27 10:08:40
Kohana
Anton, 2015-07-27 10:08:40

Rss newsfeed for a site, kohana 3.1, does not generate rss, how to solve the problem?

Hello, I set rss for categories, which would take news from categories and generate a list of rss. So I'm trying to follow the link site.ru/category/rss and it redirects to the main page.

public function action_rss()
{
//Устанавливаем заголовок RSS канала
$info = array(
'title' => 'Новости приморского края',
'language' => 'ru',
'description' => 'Новости приморского края',
'link' => 'http://site.ru/category/rss',
'pubDate' => time());

//Выбираем все категории новостей нашего сайта, с флагом show=1
$categories = ORM::factory('category')->where('show_cat', '=', 1)
->find_all();

$items = array();

//Перебираем наши новости и загоняем их в массив
$siteurl = 'http://site.ru';
foreach ($categories as $category)
{
if($category->id == '1')
{
$url = $siteurl.'/category/views/'.$category->alias.'';
$items[] = array(
'title' => $category->name,
'link' => $url,
'guid' => $url,
'description' => $category->cattext 
);
}
else
{
$url = $siteurl.'/category/views/'.$category->alias.'';
$items[] = array(
'title' => $category->name,
'link' => $url,
'guid' => $url,
'description' => $category->cattext 
);
}
}

Where did I make a mistake?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
entermix, 2015-07-27
Websaytovsky @ws17

Maybe it's in the settings of the routes?

A
Anton, 2015-08-12
Websaytovsky @ws17

To display a picture in rss, the code was suggested, but it gives an error, I can’t display the picture correctly, I tried to display just a picture from a folder on the hosting.

$image = '<p><img class="center" src="' . ['/media/uploads/noimage.jpg'] . '" /></p>',
$rssfeed .= '<description><![CDATA[' . $image . ']]></description>' . "\n\t",

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question