Re: How to add a remote RSS feed to your BxCMS page

Christian Stocker <[email protected]>
Newsgroups gmane.comp.cms.bitflux.general
Message-ID <[email protected]>
Reply to a very old post here ;)

I just added code to the Forum  how to do the following internally (for
example for latest comments from the very same cms installation).

See http://forum.freeflux.net/index.php?t=msg&goto=178&rid=2#msg_178

The example below is still useful if you want to parse external XML files.

chregu


On 29.3.2005 22:29 Uhr, Christian Stocker wrote:
> Just added some code to make it easily available.
> 
> Add the following to the designated XSLT (could be master.xsl somewhere
> in the  <div id="left"> region):
> 
> <xsl:for-each
> select="php:function('bx_helpers_simplecache::staticHttpReadAsDom','http://pfad/zu/feed.xml')/rdf:RDF/rss:item[position()
> &lt; 11]">
>        <li><a title="{rss:description}   - Categories: {dc:subject}"
> href="{rss:link}"><xsl:value-of select="rss:title"/></a></li>
> </xsl:for-each>
> 
> 
> This is for an RSS 1.0 (RDF) feed, you have to adjust the xpath
> accordingly, if it's RSS 2.0 or something else. You also maybe have to
> register the namespaces in the xslt, for the above example:
> 
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:rss="http://purl.org/rss/1.0/"
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> 
> staticHttpReadAsDom above will cache the result for one hour, if you
> want less or more time caching that you can add this as 2nd parameter
> 
> php:function('bx_helpers_simplecache::staticHttpReadAsDom','http://pfad/zu/feed.xml',1800)
> 
> would cache it for 1800 seconds.
> 
> HTH
> 
> chregu

-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  [email protected]  |  gnupg-keyid 0x5CE1DECB
-- 
bitflux-cms mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.