RSS generator for newspapers
- Ariadne >
- Community >
- Code Gallery >
- Data >
A set of templates to generate an rss xml feed from a newspaper in Ariadne.
Template 1: pnewspaper::rss.xml
<pinp>
ldSetContent("text/xml");
echo '<'.'?xml version="1.0" encoding="UTF-8" ?'.'>';
</pinp>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title><![CDATA[<pinp> echo $nlsdata->name; </pinp>]]></title>
<link><pinp> echo make_url("", "", false); </pinp></link>
<description>
<![CDATA[<pinp> echo $nlsdata->summary; </pinp>]]>
</description>
<generator>Ariadne Web Application Server</generator>
<docs>http://backend.userland.com/rss</docs>
<pinp>
$articles=get_articles("default");
if (is_array($articles)) {
while (list($key,$article)=each($articles)) {
</pinp>
<item>
<title><![CDATA[<pinp>
echo $article->nlsdata->name;
</pinp>]]></title>
<link><pinp>
echo make_url($article->path,"",false);
</pinp></link>
<description><![CDATA[<pinp>
echo $article->nlsdata->summary;
</pinp>]]></description>
<content:encoded><![CDATA[<pinp>
$article->ShowPage();
</pinp>]]></content:encoded>
<pubDate><pinp>
echo gmdate('D, d M Y H:i:s \G\M\T',
$article->data->startdate+$article->data->starttime);
</pinp></pubDate>
<guid><pinp>
echo make_url($article->path,"",false);
</pinp></guid>
</item>
<pinp>
}
}
</pinp>
</channel>
</rss>
Template 2: pnewspaper::view.rss.html
<pinp>
$graphics_url=make_url(currentsite().'graphics/',false,false);
</pinp>
<div id='rss'>
<a href="<pinp> echo make_url("", "", false); </pinp>rss.xml"><img
src="<pinp> echo $graphics_url; </pinp>xml.gif"
width="36" height="14" border="0"
alt= "Click here to see an XML representation of the content
of this
weblog."></a>
<br><br> <ahref="http://127.0.0.1:5335/system/pages/subscriptions?url=<pinp>
echo RawUrlEncode(make_url("","",false).'rss.xml'); </pinp>"><img
src="<pinp> echo $graphics_url; </pinp>xmlCoffeeCup.gif"
border="0" width="36" height="36"
alt="Click on the XML coffee mug to subscribe to "<pinp>
echo $nlsdata->name; </pinp>" in Radio UserLand."></a>
</div>



