[campsite-dev] My hack to get RSS working
  • I recently discovered the magic of RSS aggregators (tried out
    kaggregator on KDE), and realized that Campsite's RSS feed didnt work
    with it. Ok, no problem, i thought, cant be that hard to get it
    working...ahem.

    After several attempts, the following is the simplest I've been able
    to make it. Maybe someone knows a less hackier way to do this. If
    you know, please tell me, because I want to post some intructions in
    the manual.

    Summary:
    This hack is the result of trying to overcome three problems:

    1) There doesnt seem like there is a way in campsite to display a
    specific template, except by creating an empty section and assigning
    the template to it.
    2) There isnt a way in the template language to set the HTTP headers
    of a page. In this case we need to tell the browser that the
    "Content-type" is "text/xml".
    3) PHP wrapper annoyances

    Step 1) Create your RSS feed. Create a template named "rss.tpl" that
    looks something like what written below. Notice that there is no
    at the top. This is on purpose, if you put it
    in there the PHP wrapper will think this is PHP code and try to
    execute it (point #3 above). When it tries to do this, it will crash.
    I've tested the RSS below using a web-based feed validator and it
    says it still checks out even without the XML tag. The PHP code at
    the beginning and end of the sample below is to overcome point #2
    above and also to strip out HTML from the new stories.
    -----------------------------------------------------------------------------------------------
    ob_start();
    ?>
    xmlns="http://purl.org/rss/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">


    Campware News
    http://www.campware.org
    Free Software for a Free Press
    en-us






















    <!** print article name>
    http://www.campware.org
    body>
    "%Y-%m-%d">T00:00:00+00:00




    header("Content-type: text/xml");

    $content = ob_get_clean();

    // Optional: remove mixed content to insure 100% compatible RSS.
    // Comment out the next 2 lines if you dont want this.
    $allowedTags="<link><description><dc:language><dc:date><item><items>";<br /> $content = strip_tags($content, $allowedTags);<br /> <br /> echo $content;<br /> ?><br /> ---------------------------------------------------------------------------------------------<br /> <br /> Step 2) Because of problem #1 above, we need to assign this template<br /> to a section. So create a new section (doesnt matter where), and call<br /> it "rss". Configure the section so that its templates are "rss.tpl",<br /> and give the section the URL name of "rss". The URL to this section<br /> will be the URL to your RSS feed.<br /> <br /> <br /> - Paul </div> </div> </li> <div style="float: right; margin-top: 12px; z-index: 999; position: relative"><fb:like href="http://forum.sourcefabric.org//discussion/3742/campsite-dev-my-hack-to-get-rss-working" layout="button_count" width="60" show_faces="false" font="lucida grande"></fb:like><g:plusone size="medium"></g:plusone></div><div class="Share"><span class="st_twitter_hcount" displayText="Tweet"></span><span class="st_facebook_hcount" displayText="Share"></span><span class="st_email_hcount" displayText="Email"></span><span class="st_sharethis_hcount" displayText="Share"></span></div> <li> <div class="Tabs DiscussionTabs AnswerTabs"> <strong>5 Comments</strong> sorted by <ul> <li class="Active"><a href="http://forum.sourcefabric.org/discussion/3742/campsite-dev-my-hack-to-get-rss-working?Sort=popular" rel="nofollow">Votes</a></li> <li><a href="http://forum.sourcefabric.org/discussion/3742/campsite-dev-my-hack-to-get-rss-working?Sort=date" rel="nofollow">Date Added</a></li> </ul> </div> </li> <li class="Item Comment Alt" id="Comment_3743"> <div class="Comment"> <div class="Meta"> <span class="Votes"><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteUp SignInPopup"><i class="ArrowSprite SpriteUp" rel="nofollow"><i>Vote Up</i></i></a><span>0</span><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteDown SignInPopup"><i class="ArrowSprite SpriteDown" rel="nofollow"><i>Vote Down</i></i></a></span> <span class="Author"> <a title="import" href="/profile/5/import" class="ProfileLink"><img src="http://www.gravatar.com/avatar.php?gravatar_id=8b5cac9282793bbea21829928a23f361&size=50&default=http%3A%2F%2Fforum.sourcefabric.org%2Fplugins%2FGravatar%2Fdefault.gif" alt="import" class="ProfilePhotoMedium" /></a><a href="/profile/5/import">import</a> </span> <span class="DateCreated"> <a href="/discussion/comment/3743#Comment_3743" class="Permalink" name="Item_2" rel="nofollow">April 2010</a> </span> <div class="CommentInfo"> <span>Posts: 0</span><span>Member</span> </div> </div> <div class="Message"> (this one is for mugur)<br /> By the way, I didnt see a way to get the time for the publish date -<br /> is there a way to do that? ( look in the code below for what I did for<br /> the publish date)<br /> <br /> <br /> On 4/5/06, Paul Baranowski <paulbaranowski@gmail.com> wrote:<br /> > I recently discovered the magic of RSS aggregators (tried out<br /> > kaggregator on KDE), and realized that Campsite's RSS feed didnt work<br /> > with it. Ok, no problem, i thought, cant be that hard to get it<br /> > working...ahem.<br /> ><br /> > After several attempts, the following is the simplest I've been able<br /> > to make it. Maybe someone knows a less hackier way to do this. If<br /> > you know, please tell me, because I want to post some intructions in<br /> > the manual.<br /> ><br /> > Summary:<br /> > This hack is the result of trying to overcome three problems:<br /> ><br /> > 1) There doesnt seem like there is a way in campsite to display a<br /> > specific template, except by creating an empty section and assigning<br /> > the template to it.<br /> > 2) There isnt a way in the template language to set the HTTP headers<br /> > of a page. In this case we need to tell the browser that the<br /> > "Content-type" is "text/xml".<br /> > 3) PHP wrapper annoyances<br /> ><br /> > Step 1) Create your RSS feed. Create a template named "rss.tpl" that<br /> > looks something like what written below. Notice that there is no<br /> > <?xml version="1.0"...> at the top. This is on purpose, if you put it<br /> > in there the PHP wrapper will think this is PHP code and try to<br /> > execute it (point #3 above). When it tries to do this, it will crash.<br /> > I've tested the RSS below using a web-based feed validator and it<br /> > says it still checks out even without the XML tag. The PHP code at<br /> > the beginning and end of the sample below is to overcome point #2<br /> > above and also to strip out HTML from the new stories.<br /> > -----------------------------------------------------------------------------------------------<br /> > <?php<br /> > ob_start();<br /> > ?><br /> > <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"<br /> > xmlns="<a href="http://purl.org/rss/1.0/" target="_blank">http://purl.org/rss/1.0/</a>"<br /> > xmlns:dc="<a href="http://purl.org/dc/elements/1.1/" target="_blank">http://purl.org/dc/elements/1.1/</a>"><br /> ><br /> > <channel rdf:about="http://www.campware.org"><br /> > <title>Campware News
    > http://www.campware.org
    > Free Software for a Free Press
    > en-us
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >

    >

    >

    >
    >
    >
    >
    >
    >
    >
    >
    > <!** print article name>
    > http://www.campware.org
    > > body>
    > > "%Y-%m-%d">T00:00:00+00:00
    >

    >
    >
    >

    > > header("Content-type: text/xml");
    >
    > $content = ob_get_clean();
    >
    > // Optional: remove mixed content to insure 100% compatible RSS.
    > // Comment out the next 2 lines if you dont want this.
    > $allowedTags="<link><description><dc:language><dc:date><item><items>";<br /> > $content = strip_tags($content, $allowedTags);<br /> ><br /> > echo $content;<br /> > ?><br /> > ---------------------------------------------------------------------------------------------<br /> ><br /> > Step 2) Because of problem #1 above, we need to assign this template<br /> > to a section. So create a new section (doesnt matter where), and call<br /> > it "rss". Configure the section so that its templates are "rss.tpl",<br /> > and give the section the URL name of "rss". The URL to this section<br /> > will be the URL to your RSS feed.<br /> ><br /> ><br /> > - Paul<br /> > </div> </div> </li> <li class="Item Comment" id="Comment_3744"> <div class="Comment"> <div class="Meta"> <span class="Votes"><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteUp SignInPopup"><i class="ArrowSprite SpriteUp" rel="nofollow"><i>Vote Up</i></i></a><span>0</span><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteDown SignInPopup"><i class="ArrowSprite SpriteDown" rel="nofollow"><i>Vote Down</i></i></a></span> <span class="Author"> <a title="import" href="/profile/5/import" class="ProfileLink"><img src="http://www.gravatar.com/avatar.php?gravatar_id=8b5cac9282793bbea21829928a23f361&size=50&default=http%3A%2F%2Fforum.sourcefabric.org%2Fplugins%2FGravatar%2Fdefault.gif" alt="import" class="ProfilePhotoMedium" /></a><a href="/profile/5/import">import</a> </span> <span class="DateCreated"> <a href="/discussion/comment/3744#Comment_3744" class="Permalink" name="Item_3" rel="nofollow">April 2010</a> </span> <div class="CommentInfo"> <span>Posts: 0</span><span>Member</span> </div> </div> <div class="Message"> Hi Paul,<br /> had same problems with rss on our instances especialy because "pseudo <br /> rss"(created only from tpl files) how i like to call it cannot be read in <br /> Firefox feed reader(integrated). Looks like Firefox expect rss to be served <br /> as XML file only. So, I came upto this... basicly, as for template there are <br /> no big differences, only part where file header is set.<br /> <br /> <?php header("Content-Type: text/xml"); ?><br /> <?php echo("<?xml version=\"1.0\" encoding=\"utf-8\"?><br /> "); ?><br /> <?php echo("<?xml-stylesheet title=\"XSL_formatting\" type=\"text/xsl\" <br /> href=\<!** uri template /rss/style.tpl\?><br /> "); ?><br /> <br /> basicly the same, except you dont need to escape from wrapper, but You will <br /> need to escape quotes as usualy in php, though I like the way You stripped <br /> html tags, i had ugly solution with external php script called from cron via <br /> lynx... You can wrap it in CDATA for description in RSS, but then XSL in <br /> firefox will not return it correctly if I recall it right...<br /> last, third line, is for XSL template (check out www.mediaonweb.org and <br /> click on RSS link). So, as You can see, drawback is that we cannot get <br /> RFC-822 date needed for RSS 2.0(yes you can hack it with adding not acurate <br /> time and timezone).<br /> <br /> ----- Original Message ----- <br /> From: "Paul Baranowski" <paulbaranowski@gmail.com><br /> To: <campsite-dev@campware.org><br /> Sent: Wednesday, April 05, 2006 2:47 PM<br /> Subject: [campsite-dev] Re: My hack to get RSS working<br /> <br /> <br /> (this one is for mugur)<br /> By the way, I didnt see a way to get the time for the publish date -<br /> is there a way to do that? ( look in the code below for what I did for<br /> the publish date)<br /> <br /> <br /> On 4/5/06, Paul Baranowski <paulbaranowski@gmail.com> wrote:<br /> > I recently discovered the magic of RSS aggregators (tried out<br /> > kaggregator on KDE), and realized that Campsite's RSS feed didnt work<br /> > with it. Ok, no problem, i thought, cant be that hard to get it<br /> > working...ahem.<br /> ><br /> > After several attempts, the following is the simplest I've been able<br /> > to make it. Maybe someone knows a less hackier way to do this. If<br /> > you know, please tell me, because I want to post some intructions in<br /> > the manual.<br /> ><br /> > Summary:<br /> > This hack is the result of trying to overcome three problems:<br /> ><br /> > 1) There doesnt seem like there is a way in campsite to display a<br /> > specific template, except by creating an empty section and assigning<br /> > the template to it.<br /> > 2) There isnt a way in the template language to set the HTTP headers<br /> > of a page. In this case we need to tell the browser that the<br /> > "Content-type" is "text/xml".<br /> > 3) PHP wrapper annoyances<br /> ><br /> > Step 1) Create your RSS feed. Create a template named "rss.tpl" that<br /> > looks something like what written below. Notice that there is no<br /> > <?xml version="1.0"...> at the top. This is on purpose, if you put it<br /> > in there the PHP wrapper will think this is PHP code and try to<br /> > execute it (point #3 above). When it tries to do this, it will crash.<br /> > I've tested the RSS below using a web-based feed validator and it<br /> > says it still checks out even without the XML tag. The PHP code at<br /> > the beginning and end of the sample below is to overcome point #2<br /> > above and also to strip out HTML from the new stories.<br /> > -----------------------------------------------------------------------------------------------<br /> > <?php<br /> > ob_start();<br /> > ?><br /> > <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"<br /> > xmlns="<a href="http://purl.org/rss/1.0/" target="_blank">http://purl.org/rss/1.0/</a>"<br /> > xmlns:dc="<a href="http://purl.org/dc/elements/1.1/" target="_blank">http://purl.org/dc/elements/1.1/</a>"><br /> ><br /> > <channel rdf:about="http://www.campware.org"><br /> > <title>Campware News
    > http://www.campware.org
    > Free Software for a Free Press
    > en-us
    >
    >
    >
    >
    >
    >
    >
    > > desc>
    >
    >
    >
    >

    >

    >

    >
    >
    >
    >
    >
    >
    >
    >
    > <!** print article name>
    > http://www.campware.org
    > > body>
    > > "%Y-%m-%d">T00:00:00+00:00
    >

    >
    >
    >

    > > header("Content-type: text/xml");
    >
    > $content = ob_get_clean();
    >
    > // Optional: remove mixed content to insure 100% compatible RSS.
    > // Comment out the next 2 lines if you dont want this.
    > $allowedTags="<link><description><dc:language><dc:date><item><items>";<br /> > $content = strip_tags($content, $allowedTags);<br /> ><br /> > echo $content;<br /> > ?><br /> > ---------------------------------------------------------------------------------------------<br /> ><br /> > Step 2) Because of problem #1 above, we need to assign this template<br /> > to a section. So create a new section (doesnt matter where), and call<br /> > it "rss". Configure the section so that its templates are "rss.tpl",<br /> > and give the section the URL name of "rss". The URL to this section<br /> > will be the URL to your RSS feed.<br /> ><br /> ><br /> > - Paul<br /> > </div> </div> </li> <li class="Item Comment Alt" id="Comment_3745"> <div class="Comment"> <div class="Meta"> <span class="Votes"><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteUp SignInPopup"><i class="ArrowSprite SpriteUp" rel="nofollow"><i>Vote Up</i></i></a><span>0</span><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteDown SignInPopup"><i class="ArrowSprite SpriteDown" rel="nofollow"><i>Vote Down</i></i></a></span> <span class="Author"> <a title="import" href="/profile/5/import" class="ProfileLink"><img src="http://www.gravatar.com/avatar.php?gravatar_id=8b5cac9282793bbea21829928a23f361&size=50&default=http%3A%2F%2Fforum.sourcefabric.org%2Fplugins%2FGravatar%2Fdefault.gif" alt="import" class="ProfilePhotoMedium" /></a><a href="/profile/5/import">import</a> </span> <span class="DateCreated"> <a href="/discussion/comment/3745#Comment_3745" class="Permalink" name="Item_4" rel="nofollow">April 2010</a> </span> <div class="CommentInfo"> <span>Posts: 0</span><span>Member</span> </div> </div> <div class="Message"> Hi Paul<br /> <br /> I tested my RSS templates with bloglines.com and other tools and they<br /> seemed to work. Certainly the HTTP Content-Type header is important. I<br /> used a custom-coded wrapper to process mine. If you don't have access to<br /> the code I can sent it to you -- it's part of the campsite template work<br /> that I did. I don't kno w if/how it works with the new version(s).<br /> <br /> Cheers<br /> JP<br /> <br /> Paul Baranowski wrote:<br /> <br /> >I recently discovered the magic of RSS aggregators (tried out<br /> >kaggregator on KDE), and realized that Campsite's RSS feed didnt work<br /> >with it. Ok, no problem, i thought, cant be that hard to get it<br /> >working...ahem.<br /> ><br /> >After several attempts, the following is the simplest I've been able<br /> >to make it. Maybe someone knows a less hackier way to do this. If<br /> >you know, please tell me, because I want to post some intructions in<br /> >the manual.<br /> ><br /> >Summary:<br /> >This hack is the result of trying to overcome three problems:<br /> ><br /> >1) There doesnt seem like there is a way in campsite to display a<br /> >specific template, except by creating an empty section and assigning<br /> >the template to it.<br /> >2) There isnt a way in the template language to set the HTTP headers<br /> >of a page. In this case we need to tell the browser that the<br /> >"Content-type" is "text/xml".<br /> >3) PHP wrapper annoyances<br /> ><br /> >Step 1) Create your RSS feed. Create a template named "rss.tpl" that<br /> >looks something like what written below. Notice that there is no<br /> ><?xml version="1.0"...> at the top. This is on purpose, if you put it<br /> >in there the PHP wrapper will think this is PHP code and try to<br /> >execute it (point #3 above). When it tries to do this, it will crash.<br /> > I've tested the RSS below using a web-based feed validator and it<br /> >says it still checks out even without the XML tag. The PHP code at<br /> >the beginning and end of the sample below is to overcome point #2<br /> >above and also to strip out HTML from the new stories.<br /> >-----------------------------------------------------------------------------------------------<br /> ><?php<br /> >ob_start();<br /> >?><br /> ><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"<br /> >xmlns="<a href="http://purl.org/rss/1.0/" target="_blank">http://purl.org/rss/1.0/</a>"<br /> >xmlns:dc="<a href="http://purl.org/dc/elements/1.1/" target="_blank">http://purl.org/dc/elements/1.1/</a>"><br /> ><br /> > <channel rdf:about="http://www.campware.org"><br /> > <title>Campware News
    > http://www.campware.org
    > Free Software for a Free Press
    > en-us
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >

    >

    >

    >
    >
    >
    >
    >
    >
    >
    >
    > <!** print article name>
    > http://www.campware.org
    > >body>
    > >"%Y-%m-%d">T00:00:00+00:00
    >

    >
    >
    >

    > >header("Content-type: text/xml");
    >
    >$content = ob_get_clean();
    >
    >// Optional: remove mixed content to insure 100% compatible RSS.
    >// Comment out the next 2 lines if you dont want this.
    >$allowedTags="<link><description><dc:language><dc:date><item><items>";<br /> >$content = strip_tags($content, $allowedTags);<br /> ><br /> >echo $content;<br /> >?><br /> >---------------------------------------------------------------------------------------------<br /> ><br /> >Step 2) Because of problem #1 above, we need to assign this template<br /> >to a section. So create a new section (doesnt matter where), and call<br /> >it "rss". Configure the section so that its templates are "rss.tpl",<br /> >and give the section the URL name of "rss". The URL to this section<br /> >will be the URL to your RSS feed.<br /> ><br /> ><br /> >- Paul<br /> ><br /> > <br /> > </div> </div> </li> <li class="Item Comment" id="Comment_3746"> <div class="Comment"> <div class="Meta"> <span class="Votes"><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteUp SignInPopup"><i class="ArrowSprite SpriteUp" rel="nofollow"><i>Vote Up</i></i></a><span>0</span><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteDown SignInPopup"><i class="ArrowSprite SpriteDown" rel="nofollow"><i>Vote Down</i></i></a></span> <span class="Author"> <a title="import" href="/profile/5/import" class="ProfileLink"><img src="http://www.gravatar.com/avatar.php?gravatar_id=8b5cac9282793bbea21829928a23f361&size=50&default=http%3A%2F%2Fforum.sourcefabric.org%2Fplugins%2FGravatar%2Fdefault.gif" alt="import" class="ProfilePhotoMedium" /></a><a href="/profile/5/import">import</a> </span> <span class="DateCreated"> <a href="/discussion/comment/3746#Comment_3746" class="Permalink" name="Item_5" rel="nofollow">April 2010</a> </span> <div class="CommentInfo"> <span>Posts: 0</span><span>Member</span> </div> </div> <div class="Message"> Hi Paul,<br /> <br /> "1) There doesnt seem like there is a way in campsite to display a<br /> specific template, except by creating an empty section and assigning the template to it."<br /> <br /> Yes, there is a way to display a specific template, see chapter "5.5.38. URIPath, URLParameters, URI, FormParameters" in the manual:<br /> <a href="http://code.campware.org/manuals/campsite/2.5/index.php?id=98" target="_blank">http://code.campware.org/manuals/campsite/2.5/index.php?id=98</a><br /> <br /> The syntax is: URI template <template_name><br /> <br /> This will append tpl=<template_id> to the parameters list.<br /> <br /> Mugur<br /> <br /> Paul Baranowski <paulbaranowski@gmail.com> wrote: I recently discovered the magic of RSS aggregators (tried out<br /> kaggregator on KDE), and realized that Campsite's RSS feed didnt work<br /> with it. Ok, no problem, i thought, cant be that hard to get it<br /> working...ahem.<br /> <br /> After several attempts, the following is the simplest I've been able<br /> to make it. Maybe someone knows a less hackier way to do this. If<br /> you know, please tell me, because I want to post some intructions in<br /> the manual.<br /> <br /> Summary:<br /> This hack is the result of trying to overcome three problems:<br /> <br /> 1) There doesnt seem like there is a way in campsite to display a<br /> specific template, except by creating an empty section and assigning<br /> the template to it.<br /> 2) There isnt a way in the template language to set the HTTP headers<br /> of a page. In this case we need to tell the browser that the<br /> "Content-type" is "text/xml".<br /> 3) PHP wrapper annoyances<br /> <br /> Step 1) Create your RSS feed. Create a template named "rss.tpl" that<br /> looks something like what written below. Notice that there is no<br /> at the top. This is on purpose, if you put it<br /> in there the PHP wrapper will think this is PHP code and try to<br /> execute it (point #3 above). When it tries to do this, it will crash.<br /> I've tested the RSS below using a web-based feed validator and it<br /> says it still checks out even without the XML tag. The PHP code at<br /> the beginning and end of the sample below is to overcome point #2<br /> above and also to strip out HTML from the new stories.<br /> -----------------------------------------------------------------------------------------------<br /> ob_start();<br /> ?><br /> <br /> xmlns="<a href="http://purl.org/rss/1.0/" target="_blank">http://purl.org/rss/1.0/</a>"<br /> xmlns:dc="<a href="http://purl.org/dc/elements/1.1/" target="_blank">http://purl.org/dc/elements/1.1/</a>"><br /> <br /> <br /> Campware News <br /> <br /> <a href="http://www.campware.org" target="_blank">http://www.campware.org</a><br /> Free Software for a Free Press<br /> en-us<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <!** print article name> <br /> <br /> <a href="http://www.campware.org" target="_blank">http://www.campware.org</a><br /> body><br /> "%Y-%m-%d">T00:00:00+00:00<br /> <br /> <br /> <br /> <br /> header("Content-type: text/xml");<br /> <br /> $content = ob_get_clean();<br /> <br /> // Optional: remove mixed content to insure 100% compatible RSS.<br /> // Comment out the next 2 lines if you dont want this.<br /> $allowedTags="<br /> ";<br /> $content = strip_tags($content, $allowedTags);<br /> <br /> echo $content;<br /> ?><br /> ---------------------------------------------------------------------------------------------<br /> <br /> Step 2) Because of problem #1 above, we need to assign this template<br /> to a section. So create a new section (doesnt matter where), and call<br /> it "rss". Configure the section so that its templates are "rss.tpl",<br /> and give the section the URL name of "rss". The URL to this section<br /> will be the URL to your RSS feed.<br /> <br /> <br /> - Paul<br /> <br /> <br /> <br /> ---------------------------------<br /> Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.<br /> <br /> ---------------------------------<br /> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. </div> </div> </li> <li class="Item Comment Alt" id="Comment_3747"> <div class="Comment"> <div class="Meta"> <span class="Votes"><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteUp SignInPopup"><i class="ArrowSprite SpriteUp" rel="nofollow"><i>Vote Up</i></i></a><span>0</span><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="VoteDown SignInPopup"><i class="ArrowSprite SpriteDown" rel="nofollow"><i>Vote Down</i></i></a></span> <span class="Author"> <a title="import" href="/profile/5/import" class="ProfileLink"><img src="http://www.gravatar.com/avatar.php?gravatar_id=8b5cac9282793bbea21829928a23f361&size=50&default=http%3A%2F%2Fforum.sourcefabric.org%2Fplugins%2FGravatar%2Fdefault.gif" alt="import" class="ProfilePhotoMedium" /></a><a href="/profile/5/import">import</a> </span> <span class="DateCreated"> <a href="/discussion/comment/3747#Comment_3747" class="Permalink" name="Item_6" rel="nofollow">April 2010</a> </span> <div class="CommentInfo"> <span>Posts: 0</span><span>Member</span> </div> </div> <div class="Message"> Yep, you are right, please file a ticket for me to implement this in 2.6<br /> <br /> Mugur<br /> <br /> Paul Baranowski <paulbaranowski@gmail.com> wrote: (this one is for mugur)<br /> By the way, I didnt see a way to get the time for the publish date - is there a way to do that? ( look in the code below for what I did for the publish date)<br /> <br /> <br /> On 4/5/06, Paul Baranowski <br /> wrote:<br /> > I recently discovered the magic of RSS aggregators (tried out<br /> > kaggregator on KDE), and realized that Campsite's RSS feed didnt work<br /> > with it. Ok, no problem, i thought, cant be that hard to get it<br /> > working...ahem.<br /> ><br /> > After several attempts, the following is the simplest I've been able<br /> > to make it. Maybe someone knows a less hackier way to do this. If<br /> > you know, please tell me, because I want to post some intructions in<br /> > the manual.<br /> ><br /> > Summary:<br /> > This hack is the result of trying to overcome three problems:<br /> ><br /> > 1) There doesnt seem like there is a way in campsite to display a<br /> > specific template, except by creating an empty section and assigning<br /> > the template to it.<br /> > 2) There isnt a way in the template language to set the HTTP headers<br /> > of a page. In this case we need to tell the browser that the<br /> > "Content-type" is "text/xml".<br /> > 3) PHP wrapper annoyances<br /> ><br /> > Step 1) Create your RSS feed. Create a template named "rss.tpl" that<br /> > looks something like what written below. Notice that there is no<br /> > at the top. This is on purpose, if you put it<br /> > in there the PHP wrapper will think this is PHP code and try to<br /> > execute it (point #3 above). When it tries to do this, it will crash.<br /> > I've tested the RSS below using a web-based feed validator and it<br /> > says it still checks out even without the XML tag. The PHP code at<br /> > the beginning and end of the sample below is to overcome point #2<br /> > above and also to strip out HTML from the new stories.<br /> > -----------------------------------------------------------------------------------------------<br /> > > ob_start();<br /> > ?><br /> > <br /> > xmlns="<a href="http://purl.org/rss/1.0/" target="_blank">http://purl.org/rss/1.0/</a>"<br /> > xmlns:dc="<a href="http://purl.org/dc/elements/1.1/" target="_blank">http://purl.org/dc/elements/1.1/</a>"><br /> ><br /> > <br /> Campware News> <br /> > <br /> <a href="http://www.campware.org" target="_blank">http://www.campware.org</a><br /> > Free Software for a Free Press<br /> > en-us<br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> ><br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> <!** print article name>> <br /> > <br /> <a href="http://www.campware.org" target="_blank">http://www.campware.org</a><br /> > > body><br /> > > "%Y-%m-%d">T00:00:00+00:00<br /> > <br /> > <br /> > <br /> > <br /> > > header("Content-type: text/xml");<br /> ><br /> > $content = ob_get_clean();<br /> ><br /> > // Optional: remove mixed content to insure 100% compatible RSS.<br /> > // Comment out the next 2 lines if you dont want this.<br /> > $allowedTags="<br /> ";<br /> > $content = strip_tags($content, $allowedTags);<br /> ><br /> > echo $content;<br /> > ?><br /> > ---------------------------------------------------------------------------------------------<br /> ><br /> > Step 2) Because of problem #1 above, we need to assign this template<br /> > to a section. So create a new section (doesnt matter where), and call<br /> > it "rss". Configure the section so that its templates are "rss.tpl",<br /> > and give the section the URL name of "rss". The URL to this section<br /> > will be the URL to your RSS feed.<br /> ><br /> ><br /> > - Paul<br /> ><br /> <br /> <br /> <br /> <br /> ---------------------------------<br /> How low will we go? Check out Yahoo! Messenger </div> </div> </li> </ul> <div class="Foot"> <a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working%3Fpost%23Form_Body" class="TabLink">Add a Comment</a> </div> </div> <div id="Panel"> <div class="Search"><form method="get" action="https://www.google.com/search"> <div> <input type="hidden" name="sitesearch" value="forum.sourcefabric.org" /><input type="text" id="Form_q" name="q" value="" class="InputBox" /><input type="submit" id="Form_Search" value="Search" class="Searchbutton" /> </div> </form> </div> <a href="/post/discussion/10" class="BigButton NewDiscussion">Start a New Discussion</a><div class="Box GuestBox"> <h4>Howdy, Stranger!</h4> <p>It looks like you're new here. If you want to get involved, click one of these buttons!</p> <div class="P"><a href="/entry/signin?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="Button">Sign In</a> <a href="/entry/register?Target=discussion%2F3742%2Fcampsite-dev-my-hack-to-get-rss-working" class="Button ApplyButton">Apply for Membership</a></div> </div><div class="Box BoxCategories"> <h4><a href="/categories/all">Categories</a></h4> <ul class="PanelInfo PanelCategories"> <li><span><strong><a href="/discussions">All Discussions</a></strong><span class="Count">8,397</span></span></li> <li class="Heading CategoryID_1">Sourcefabric</li> <li class="Depth2 CategoryID_40"><strong><a href="/categories/announcements"><span style="font-size:18px;">↳</span> Announcements</a></strong><span class="Count">25</span></li> <li class="Heading CategoryID_8">Newscoop</li> <li class="Depth2 CategoryID_9"><strong><a href="/categories/newscoop-support"><span style="font-size:18px;">↳</span> Newscoop Support</a></strong><span class="Count">2,189</span></li> <li class="Depth2 Active CategoryID_10"><strong><a href="/categories/newscoop-development"><span style="font-size:18px;">↳</span> Newscoop Development</a></strong><span class="Count">722</span></li> <li class="Depth2 CategoryID_12"><strong><a href="/categories/newscoop-security"><span style="font-size:18px;">↳</span> Newscoop Security</a></strong><span class="Count">13</span></li> <li class="Depth2 CategoryID_13"><strong><a href="/categories/newscoop-documentation"><span style="font-size:18px;">↳</span> Newscoop Documentation</a></strong><span class="Count">17</span></li> <li class="Depth2 CategoryID_14"><strong><a href="/categories/newscoop-templates"><span style="font-size:18px;">↳</span> Newscoop Themes</a></strong><span class="Count">69</span></li> <li class="Heading CategoryID_15">Airtime</li> <li class="Depth2 CategoryID_16"><strong><a href="/categories/airtime-support"><span style="font-size:18px;">↳</span> Airtime Support</a></strong><span class="Count">3,139</span></li> <li class="Depth2 CategoryID_17"><strong><a href="/categories/airtime-development"><span style="font-size:18px;">↳</span> Airtime Development</a></strong><span class="Count">1,286</span></li> <li class="Depth2 CategoryID_18"><strong><a href="/categories/airtime-fr"><span style="font-size:18px;">↳</span> Airtime Français</a></strong><span class="Count">146</span></li> <li class="Depth2 CategoryID_19"><strong><a href="/categories/airtime-documentation"><span style="font-size:18px;">↳</span> Airtime Documentation</a></strong><span class="Count">14</span></li> <li class="Depth2 CategoryID_42"><strong><a href="/categories/airtime-hacks"><span style="font-size:18px;">↳</span> Airtime Hacks</a></strong><span class="Count">102</span></li> <li class="Depth2 CategoryID_20"><strong><a href="/categories/airtime-promote"><span style="font-size:18px;">↳</span> Promote your station!</a></strong><span class="Count">37</span></li> <li class="Depth2 CategoryID_21"><strong><a href="/categories/airtime-security"><span style="font-size:18px;">↳</span> Airtime Security</a></strong><span class="Count">11</span></li> <li class="Heading CategoryID_36">Booktype</li> <li class="Depth2 CategoryID_37"><strong><a href="/categories/booktype-support"><span style="font-size:18px;">↳</span> Booktype Support</a></strong><span class="Count">277</span></li> <li class="Depth2 CategoryID_38"><strong><a href="/categories/booktype-development"><span style="font-size:18px;">↳</span> Booktype Development</a></strong><span class="Count">55</span></li> <li class="Depth2 CategoryID_39"><strong><a href="/categories/booktype-documentation"><span style="font-size:18px;">↳</span> Booktype Documentation</a></strong><span class="Count">7</span></li> <li class="Heading CategoryID_31">Superdesk</li> <li class="Depth2 CategoryID_32"><strong><a href="/categories/superdesk-dev"><span style="font-size:18px;">↳</span> Superdesk Development</a></strong><span class="Count">264</span></li> <li class="Depth2 CategoryID_44"><strong><a href="/categories/web-publisher"><span style="font-size:18px;">↳</span> Web Publisher</a></strong><span class="Count">21</span></li> </ul> </div> <div class="Box"> <h4>Poll</h4> No poll attached to this discussion. </div> <div id="TopPosters" class="Box"> <h4>Top Posters</h4> <ul class="PanelInfo"> <li> <img src="/plugins/TopPosters/badges/1.png"> <strong> <a href="/profile/12/Albert%20FR">Albert FR</a> </strong> <span class="Count"> 1978 </span> </li> <li> <img src="/plugins/TopPosters/badges/2.png"> <strong> <a href="/profile/246/Martin%20Konecny">Martin Konecny</a> </strong> <span class="Count"> 1860 </span> </li> <li> <img src="/plugins/TopPosters/badges/3.png"> <strong> <a href="/profile/2/Andrey%20Podshivalov">Andrey Podshivalov</a> </strong> <span class="Count"> 1526 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/2509/Voisses%20Tech">Voisses Tech</a> </strong> <span class="Count"> 1423 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/3101/John%20Chewter">John Chewter</a> </strong> <span class="Count"> 899 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/56/Daniel%20James">Daniel James</a> </strong> <span class="Count"> 844 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/2471/Roger%20Wilco">Roger Wilco</a> </strong> <span class="Count"> 784 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/1740/hoerich">hoerich</a> </strong> <span class="Count"> 627 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/43/Paul%20Baranowski">Paul Baranowski</a> </strong> <span class="Count"> 389 </span> </li> <li> <img src="/plugins/TopPosters/badges/medal-icon.png"> <strong> <a href="/profile/1570/Cliff%20Wang">Cliff Wang</a> </strong> <span class="Count"> 339 </span> </li> </ul> </div> </div> </div> <div id="Foot"> <!-- Various definitions for Javascript //--> <div id="Definitions" style="display: none;"> <input type="hidden" id="ImageResized" value="This image has been resized to fit in the page. Click to enlarge." /> <input type="hidden" id="DiscussionID" value="3742" /> <input type="hidden" id="Emoticons" value="eyI6KV0iOiIxMDAiLCI7KSkiOiI3MSIsIjopPi0iOiI2NyIsIjopJmd0Oy0iOiI2NyIsIjopKSI6IjIxIiwiOikiOiIxIiwiOi0pIjoiMSIsIjoofCkiOiI1MSIsIjooKCI6IjIwIiwiOigiOiIyIiwiOi0oIjoiMiIsIjspIjoiMyIsIjstKSI6IjMiLCI6RCI6IjQiLCI6LUQiOiI0IiwiOzspIjoiNSIsIj46RDwiOiI2IiwiJmd0OzpEJmx0OyI6IjYiLCI6LVwvIjoiNyIsIjpcLyI6IjciLCI6eCI6IjgiLCI6WCI6IjgiLCI6XFxcIj4iOiI5IiwiOlxcXCImZ3Q7IjoiOSIsIjpQIjoiMTAiLCI6cCI6IjEwIiwiOi1wIjoiMTAiLCI6LVAiOiIxMCIsIjotKiI6IjExIiwiOioiOiIxMSIsIj0oKCI6IjEyIiwiOi1PIjoiMTMiLCI6TykiOiIzNCIsIjpPIjoiMTMiLCJYKCI6IjE0IiwiOj4iOiIxNSIsIjomZ3Q7IjoiMTUiLCJCLSkiOiIxNiIsIjotUyI6IjE3IiwiIzotUyI6IjE4IiwiIzotcyI6IjE4IiwiPjopIjoiMTkiLCI+Oi0pIjoiMTkiLCImZ3Q7OikiOiIxOSIsIiZndDs6LSkiOiIxOSIsIjotKCgiOiIyMCIsIjonKCI6IjIwIiwiOictKCI6IjIwIiwiOi0pKSI6IjIxIiwiOnwiOiIyMiIsIjotfCI6IjIyIiwiXC86KSI6IjIzIiwiXC86LSkiOiIyMyIsIj0pKSI6IjI0IiwiTzotKSI6IjI1IiwiTzopIjoiMjUiLCI6LUIiOiIyNiIsIj07IjoiMjciLCJJLSkiOiIyOCIsIjgtfCI6IjI5IiwiTC0pIjoiMzAiLCI6LSYiOiIzMSIsIjotJmFtcDsiOiIzMSIsIjowJmFtcDsiOiIzMSIsIjotJCI6IjMyIiwiWy0oIjoiMzMiLCI4LX0iOiIzNSIsIiZsdDs6LVAiOiIzNiIsIjw6LVAiOiIzNiIsIig6fCI6IjM3IiwiPVB+IjoiMzgiLCI6LT8/IjoiMTA2IiwiOi0/IjoiMzkiLCIjLW8iOiI0MCIsIiMtTyI6IjQwIiwiPUQ+IjoiNDEiLCI9RCZndDsiOiI0MSIsIjotU1MiOiI0MiIsIjotc3MiOiI0MiIsIkAtKSI6IjQzIiwiOl5vIjoiNDQiLCI6LXciOiI0NSIsIjotVyI6IjQ1IiwiOi08IjoiNDYiLCI6LSZsdDsiOiI0NiIsIj46UCI6IjQ3IiwiPjpwIjoiNDciLCImZ3Q7OlAiOiI0NyIsIiZndDs6cCI6IjQ3IiwiPCk6KSI6IjQ4IiwiJmx0Oyk6KSI6IjQ4IiwiOkApIjoiNDkiLCIzOi1PIjoiNTAiLCIzOi1vIjoiNTAiLCJ+Oj4iOiI1MiIsIn46Jmd0OyI6IjUyIiwiQH07LSI6IjUzIiwiJSUtIjoiNTQiLCIqKj09IjoiNTUiLCIofn4pIjoiNTYiLCJ+TykiOiI1NyIsIiotOikiOiI1OCIsIjgtWCI6IjU5IiwiPTopIjoiNjAiLCI+LSkiOiI2MSIsIiZndDstKSI6IjYxIiwiOi1MIjoiNjIiLCI6TCI6IjYyIiwiWy1PPCI6IjYzIiwiWy1PJmx0OyI6IjYzIiwiJC0pIjoiNjQiLCI6LVxcXCIiOiI2NSIsImItKCI6IjY2IiwiWy1YIjoiNjgiLCJcXDpEXC8iOiI2OSIsIj46XC8iOiI3MCIsIiZndDs6XC8iOiI3MCIsIm8tPiI6IjcyIiwiby0mZ3Q7IjoiNzIiLCJvPT4iOiI3MyIsIm89Jmd0OyI6IjczIiwiby0rIjoiNzQiLCIoJSkiOiI3NSIsIjotQCI6Ijc2IiwiXjopXiI6Ijc3IiwiOi1qIjoiNzgiLCIoKikiOiI3OSIsIjotYyI6IjEwMSIsIn5YKCI6IjEwMiIsIjotaCI6IjEwMyIsIjotdCI6IjEwNCIsIjgtPiI6IjEwNSIsIjgtJmd0OyI6IjEwNSIsIiUtKCI6IjEwNyIsIjpvMyI6IjEwOCIsIlhfWCI6IjEwOSIsIjohISI6IjExMCIsIlxcbVwvIjoiMTExIiwiOi1xIjoiMTEyIiwiOi1iZCI6IjExMyIsIl4jKF4iOiIxMTQiLCI6YnoiOiIxMTUiLCI6YXIhIjoicGlyYXRlIiwiWy4uXSI6InRyYW5zZm9ybWVyIn0=" /> <input type="hidden" id="apcavailable" value="" /> <input type="hidden" id="uploaderuniq" value="6737a264864c4" /> <input type="hidden" id="maxuploadsize" value="20971520" /> <input type="hidden" id="TopPostersLimit" value="10" /> <input type="hidden" id="LastCommentID" value="3742" /> <input type="hidden" id="Vanilla_Comments_AutoRefresh" value="60" /> <input type="hidden" id="TransportError" value="A fatal error occurred while processing the request.<br />The server returned the following response: %s" /> <input type="hidden" id="TransientKey" value="G68SEMA4HT1Q" /> <input type="hidden" id="WebRoot" value="http://forum.sourcefabric.org/" /> <input type="hidden" id="UrlFormat" value="/{Path}" /> <input type="hidden" id="Path" value="discussion/3742/campsite-dev-my-hack-to-get-rss-working" /> <input type="hidden" id="SignedIn" value="0" /> <input type="hidden" id="ConfirmHeading" value="Confirm" /> <input type="hidden" id="ConfirmText" value="Are you sure you want to do that?" /> <input type="hidden" id="Okay" value="Okay" /> <input type="hidden" id="Cancel" value="Cancel" /> <input type="hidden" id="Search" value="Search" /> </div> </div> </div> <iframe src="https://www.sourcefabric.org/forum_foot" border="0" style="width: 100%; height: 500px; border: 0pt none; display: block;" frameborder="0" height="460" scrolling="no" width="100%"></iframe> </body> </html> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery("pre").each(function(){ if(jQuery(this).attr("lang")!="") { var codeText=jQuery(this).html(); codeText = codeText.replace(/<br>/g, "\n"); jQuery(this).html(codeText); jQuery(this).attr("class","brush:"+$(this).attr("lang")); } }); SyntaxHighlighter.autoloader.apply(null, path( "applescript @shBrushAppleScript.js", "actionscript3 as3 @shBrushAS3.js", "bash shell @shBrushBash.js", "coldfusion cf @shBrushColdFusion.js", "cpp c @shBrushCpp.js", "c# c-sharp csharp @shBrushCSharp.js", "css @shBrushCss.js", "delphi pascal @shBrushDelphi.js", "diff patch pas @shBrushDiff.js", "erl erlang @shBrushErlang.js", "groovy @shBrushGroovy.js", "java @shBrushJava.js", "jfx javafx @shBrushJavaFX.js", "js jscript javascript @shBrushJScript.js", "perl pl @shBrushPerl.js", "php @shBrushPhp.js", "text plain @shBrushPlain.js", "py python @shBrushPython.js", "ruby rails ror rb @shBrushRuby.js", "sass scss @shBrushSass.js", "scala @shBrushScala.js", "sql @shBrushSql.js", "vb vbnet @shBrushVb.js", "xml xhtml xslt html @shBrushXml.js" )); SyntaxHighlighter.defaults["toolbar"]=false; //SyntaxHighlighter.defaults["gutter"]=false; SyntaxHighlighter.all(); }); function path() { var args = arguments, result = [] ; for(var i = 0; i < args.length; i++) result.push(args[i].replace("@", "/plugins/G_SyntaxHighlighter/scripts/")); return result }; </script>