3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1821 Views |
-
RSS feed on DataObjects

25 March 2009 at 6:01am
Hi! The tutorial shows how to use the RSSFeed for Children of the site. I would like to have DataObjects as an RSS Feed. My Problem is, the RSSFeed needs to have a LINK but I'm not able to use $this->Link() for Objects. How can I a implement a Link method for my DataObjects to use the feed?
function init() {
RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog");
parent::init();
}
function rss() {
$rss = new RSSFeed($this->MyDataObject(), $this->Link(), "My feed", "Example feed.", "Title", "Content", "Author");
$rss->outputToBrowser();
}Any idea?
-
Re: RSS feed on DataObjects

15 August 2009 at 4:58pm
Hey yea I would also like to do something like this, any ideas?
-
Re: RSS feed on DataObjects

17 August 2009 at 9:50pm
Hi,
I'm no expert but i think the link method in the data objects is used.
So if you create a custom Link method in your Data Object this will override the parent and will
also be used in the RSS feed. -
Re: RSS feed on DataObjects

17 August 2009 at 10:19pm
You're right, I figured this out yesterday so can confirm that it works
-
Re: RSS feed on DataObjects

13 September 2010 at 6:09am
Hi would be really usefull if you could supply the code you used here.
Thanks in advance
-
Re: RSS feed on DataObjects

27 September 2010 at 11:33pm Last edited: 27 September 2010 11:36pm
Like the OP I'm trying to create a RSS feed from DataObjects which do not each have their own page. However, I can't see how to create the custom Link method that is required. All the RSS entries for my feed should point to the same page where the Data Objects are listed.
So, I'd second go2planC - the code would be useful.
Thanks.
-
Re: RSS feed on DataObjects

29 September 2010 at 6:15pm Last edited: 29 September 2010 6:16pm
However, I can't see how to create the custom Link method that is required. All the RSS entries for my feed should point to the same page where the Data Objects are listed.
Well you answered your own question. The page which stores your DataObject must have a URL of some sort which you can use as the return value from Link. Eg if you had a ListPage which printed out a list of objects your link function might look like
function Link() {
$holder = DataObject::get_one('ListPage');return ($holder) ? $holder->Link() . '#item-'. $this->ID : false;
Which will generate you a link like http://yoursite.com/listpageurl#item-2. The #item-2 part is an anchor which if you're displaying posts all on the same page you can jump straight to item-2 if you have something like this setup in your html.
<div id="item-{$ID}">
// ...
</div>If you don't want to link to anywhere just create a blank link function which links to say the homepage
function Link() {
return 'home';
}
| 1821 Views | ||
|
Page:
1
|
Go to Top |




