10390 Posts in 2201 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 659 Views |
-
RSS stylesheet implementation

11 March 2011 at 5:40am
Hello there, after looking through documentation for the RSSFeed object I've discovered a glaring inadequacy. Basically I'd like to add a style sheet to my rss feed for chrome uses, for whom feed content isn't identified as being RSS (at least not in version 2.0).
In case you don't know what I mean, take a look at this link:
http://interglacial.com/~sburke/stuff/pretty_rss.html
Under the heading - The XMLCSS Approach
You can see it's just one line that I'm trying to include but RSSFeed.php is such that I can't easily see anyway to extend it to allow me to include this line. Here's hoping someone reading this has some idea.
Thanks chaps.
-
Re: RSS stylesheet implementation

11 March 2011 at 5:39pm
You can see it's just one line that I'm trying to include but RSSFeed.php is such that I can't easily see anyway to extend it to allow me to include this line. Here's hoping someone reading this has some idea.
Could you simply subclass RSSFeed and override the specific function you want to. Then in your project code you can create a new instance of your class rather than RSSFeed.
If you want to override the RSS feed created inside a module (like blog or forum) then you could use Object::useCustomClass('RSSFeed', 'MyRSSFeed') so that any instance of RSSFeed is changed to MyRSSFeed. You may need to check that they use Object::create('RSSFeed') to make the object - if they don't then update the code and submit patches to the respective modules.
-
Re: RSS stylesheet implementation

26 March 2011 at 3:40am
Thanks Willr, that's exactly what I ended up doing, works a charm except that it was difficult getting the xml headers in for chrome to recognise.
Class RssStyled Extends RSSFeed{
function feedContent(){
$prevState = SSViewer::get_source_file_comments();
SSViewer::set_source_file_comments(false);
$content = str_replace(' ', ' ', $this->renderWith('RSSFeedStyled'));
SSViewer::set_source_file_comments($prevState);
return $content;
}
}Thanks very much for your help.
| 659 Views | ||
|
Page:
1
|
Go to Top |


