/* * LinkorCMS 1.4 * © 2012 LinkorCMS Development Group */ define('RSS_SCRIPT', true); define('VALID_RUN', true); require 'config/init.php'; // Конфигурация и инициализация @header("Content-Type: text/xml"); @header("Cache-Control: no-cache"); @header("Pragma: no-cache"); $rss_title = 'Новости на ' . System::config('general/site_url'); $rss_link = System::config('general/site_url'); $rss_description = 'RSS канал сайта ' . System::config('general/site_url') . '.'; $rss = new RssChannel($rss_title, $rss_link, $rss_description); $rss->pubDate = gmdate('D, d M Y H:i:s') . ' GMT'; $rss->generator = CMS_NAME . ' ' . CMS_VERSION; $rss->managingEditor = '*****@*****.**'; $rss->webMaster = System::config('general/site_email'); $num = 10; // Пока максимум 10 заголовков по умолчанию $news = System::database()->Select('news', "`enabled`='1'", $num, 'date', true); foreach ($news as $s) { $title = SafeDB($s['title'], 255, str); $description = SafeDB($s['start_text'], 4048, str); $link = HtmlChars(GetSiteUrl() . Ufu('index.php?name=news&op=readfull&news=' . $s['id'] . '&topic=' . $s['topic_id'], 'news/{topic}/{news}/')); $pubDate = gmdate('D, d M Y H:i:s', $s['date']) . ' GMT'; $rss->AddItem($title, $description, $link, $pubDate, $link); } echo $rss->Generate();
public function Generate() { $rssChannel = new RssChannel($this->channelTitle, $this->channelLink, $this->channelDescription); $this->ApplyOrderingToDataset(); $this->ApplyLimitCountToDataset(); $this->dataset->Open(); while ($this->dataset->Next()) { $item = new RssItem(FormatDatasetFieldsTemplate($this->dataset, $this->itemTitleTemplate), FormatDatasetFieldsTemplate($this->dataset, $this->itemLinkTemplate), FormatDatasetFieldsTemplate($this->dataset, $this->itemDescriptionTemplate)); $this->SetItemPublicationDate($item); $rssChannel->AddItem($item); } $this->dataset->Close(); return $rssChannel->GenerateRss(); }