-
Notifications
You must be signed in to change notification settings - Fork 0
/
articles_rss.php
32 lines (27 loc) · 1.14 KB
/
articles_rss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require_once('api/Fivecms.php');
$fivecms = new Fivecms();
header("Content-type: text/xml; charset=UTF-8");
print '<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel>';
print '<title>'.htmlspecialchars($fivecms->settings->site_name).'</title>';
print '<link>'.$fivecms->config->root_url.'</link>';
print '<lastBuildDate>'.date("D, d M Y H:i:s O").'</lastBuildDate>';
print '<description>'.htmlspecialchars($fivecms->settings->site_name).'</description>';
$filter['visible'] = 1;
$art = $fivecms->articles->get_articles($filter);
foreach($art as $r) {
print '<item>';
print '<title>'.htmlspecialchars($r->name).'</title>';
print '<link>'.$fivecms->config->root_url.'/article/'.$r->url.'</link>';
if ($r->annotation) {
//print '<description>'.htmlspecialchars($r->annotation).'</description>';
print '<description><![CDATA['.$r->annotation.']]></description>';
} else {
print '<description><![CDATA['.$r->text.']]></description>';
}
print '<guid isPermaLink="false">'.htmlspecialchars($r->name).'</guid>';
print '<pubDate>'.date("D, d M Y H:i:s O", strtotime($r->date)).'</pubDate>';
print '</item>';
}
print ' </channel></rss>';
?>