Answer the question
In order to leave comments, you need to log in
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
);
}
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question