Jump to content

Recommended Posts


Пример http://optom.ws/
Адрес рассылки: http://optom.ws/rss
Вывод через simplexml_load_file: http://optom.ws/reader.php
Исходник http://simplacode.net/r6qf0h

Создать файл rss.php Ваш_сайт/rss.php

$simpla = new Simpla();

header("Content-type: text/xml; charset=UTF-8");
print '<?xml version="1.0" encoding="utf-8"?><rss xmlns:rss="'.$simpla->config->root_url.'" version="2.0"><channel>';
print '<title>'.$simpla->settings->site_name.'</title>';
print '<url>'.$simpla->config->root_url.'</url>';
print '<lastBuildDate>'.date("D, d M Y H:i:s O").'</lastBuildDate>';

$rss = $simpla->blog->get_posts();
foreach($rss as $r) {
print '<item>';
print '<title>'.htmlspecialchars($r->name).'</title>';
print '<link>'.$simpla->config->root_url.'/blog/'.$r->url.'</link>';
print '<description>'.htmlspecialchars($r->annotation).'</description>';
print '<pubDate>'.date("l, d M Y H:i:s O", strtotime($r->date)).'</pubDate>';
print '<pubDateUT>'.time(strtotime($r->date)).'</pubDateUT>';
print '</item>';
print ' </channel></rss>';

Добавить правило в .htaccess
# XML RewriteRule ^rss?$ rss.php [L,QSA]
Link to post
Share on other sites
  • 1 month later...

Возможно, стоит добавить и заменить:

$filter['visible'] = 1;  // Выбираем только видимые посты
$rss = $simpla->blog->get_posts($filter);


Поможет не сваливать в ленту пока неопубликованные (неактивные) посты.

Link to post
Share on other sites
  • 6 months later...
  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...