List Info

Thread: RSS Feed




RSS Feed
user name
2006-09-03 01:42:26
Hello,

Basicly, RSS in Campsite is still in domain of hacking it...
Its not too 
hard to implement but there are some issues with it. Im
pasting You Pauls 
and mine addon "solutions" for RSS. Below You
will find Pauls solution for 
it, mine is only simple tweaks if You like to use XSLT
transformations 
(which btw dont work in IE 7Beta, looks like IE is ignoring
XML with XSLT 
style in it, unlike Firefox which apply transformation...)
This is basicly 
solution for shorturls since in longurls you will have to
use custom parser 
to translate those & in urls which RSS dont like... And
maby just adding 
.htaccess with AddType directive for tpl files to be parsed
as xml (AddType 
text/xml .tpl) should do the trick also. But then again You
should move RSS 
templates to separate directory because that directive apply
on whole 
directory where .htaccess is created... I think You should
get to it by 
reading below answers...

Boban

Hi Paul,
had same problems with rss on our instances especialy
because "pseudo
rss"(created only from tpl files) how i like to call
it cannot be read in
Firefox feed reader(integrated). Looks like Firefox expect
rss to be served
as XML file only. So, I came upto this... basicly, as for
template there are
no big differences, only part where file header is set.

<?php header("Content-Type: text/xml"); ?>
<?php echo("<?xml version=\"1.0\"
encoding=\"utf-8\"?>
"); ?>
<?php echo("<?xml-stylesheet
title=\"XSL_formatting\"
type=\"text/xsl\"
href=\<!** uri template /rss/style.tpl\?>
"); ?>

basicly the same, except you dont need to escape from
wrapper, but You will
need to escape quotes as usualy in php, though I like the
way You stripped
html tags, i had ugly solution with external php script
called from cron via
lynx... You can wrap it in CDATA for description in RSS, but
then XSL in
firefox will not return it correctly if I recall it right...
last, third line, is for XSL template (check out
www.mediaonweb.org and
click on RSS link). So, as You can see, drawback is that we
cannot get
RFC-822 date needed for RSS 2.0(yes you can hack it with
adding not acurate
time and timezone).

----- Original Message ----- 
From: "Paul Baranowski" <paulbaranowskigmail.com>
To: <campsite-devcampware.org>
Sent: Wednesday, April 05, 2006 2:47 PM
Subject: [campsite-dev] Re: My hack to get RSS working


(this one is for mugur)
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)


On 4/5/06, Paul Baranowski <paulbaranowskigmail.com> wrote:
> 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
> <?xml version="1.0"...> 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.
>
------------------------------------------------------------
-----------------------------------
> <?php
> ob_start();
> ?>
> <rdf:RDF xmlns:rdf="http://ww
w.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns="http://purl.org/rss/1.0/
"
> xmlns:dc="http://purl.org/dc/e
lements/1.1/">
>
>     <channel rdf:about="http://www.campware.org&
quot;>
>         <title>Campware News</title>
>         <link>http://www.campw
are.org</link>
>         <description>Free Software for a Free
Press</description>
>         <dc:language>en-us</dc:language>
>         <items>
>           <rdf:Seq>
>             <!** Local>
>             <!** language English>
>             <!** publication name campware>
>             <!** issue current>
>             <!** section off>
>             <!** list length 20 article OnFrontPage
is on order bydate
> desc>
>             <rdf:li rdf:resource="http://www.campware.org&l
t;!** URI>"/>
>             <!** EndList>
>             <!** EndLocal>
>           </rdf:Seq>
>         </items>
>     </channel>
>
>     <!** Local>
>     <!** language English>
>     <!** publication name campware>
>     <!** issue current>
>     <!** section off>
>     <!** list length 20 article OnFrontPage is on
order bydate desc>
>     <item rdf:about="http://www.campware.org&l
t;!** URI>">
>         <title><!** print article
name></title>
>         <link>http://www.campware.org&l
t;!** URI></link>
>         <description><!** print article
intro> <!** print article
> body></description>
>         <dc:date><!** print article
publishDate
>
"%Y-%m-%d">T00:00:00+00:00</dc:date>
>     </item>
>     <!** EndList>
>     <!** EndLocal>
> </rdf:RDF>
> <?php
> 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="<rdf:RDF><rdf:Seq><rdf:li
><channel><title><link><description&
gt;<dc:language><dc:date><item><items&g
t;";
> $content = strip_tags($content, $allowedTags);
>
> echo $content;
> ?>
>
------------------------------------------------------------
---------------------------------
>
> Step 2) Because of problem #1 above, we need to assign
this template
> to a section.  So create a new section (doesnt matter
where), and call
> it "rss".  Configure the section so that
its templates are "rss.tpl",
> and give the section the URL name of "rss".
 The URL to this section
> will be the URL to your RSS feed.
>
>
> - Paul
>




----- Original Message ----- 
From: <nkerkvliethotmail.com>
To: <campsite-supportcampware.org>
Sent: Sunday, September 03, 2006 12:00 AM
Subject: [campsite-support] RSS Feed


> Good afternoon,
>
> I'm having some troubles properly displaying the rss
feed on my site. I've
> installed PHP-Wrapper and installed the rss-template
that was suggested in 
> the
> manual (adapted to my site).
>
> Using Firefox, some details show up. Using IE nothing
shows up at all. 
> I've seen
> some Campsite-sites with the same problem, but some
others do have it 
> working
> properly. Can anyone help me?
>
> The url is http://www.nieuwsbedrijf.
nl
>
> Thanks in advance! 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )