hi;
I’m trying to use getFeed to implement a list of events from a google calendar public XML feed. I have a couple of questions & a couple of issues/gotchas:
Issues/Gotchas:
- there appears to be a caching issue, I got things up and running, added a couple of events but they did not appear in the chunk output. I cleared the cache VIA the manager interface but no dice. not until I went into the site VIA shell & deleted the contents of /core/cache did the new events start showing up.
- http vs. https, https protocol does not appear to work. Taking a quick look at the code, honestly not understanding all of it, the RSS parsing is done by a modx core module? - is this what is not respecting the https protocol? [luckily google calendars will use either]
Questions:
- Is there a simple way to filter feeds? i.e. some are public, others are private, private feeds just don’t have a title value in the RSS. Is there anyway to say ’show only items with a ’title’ key?
- ordering - is it possible to order the feeds by a specific key? Currently google just publishes the feed in order of create date - which can lead to some rather odd results
- nested keys, currently it only appears to return the first level of items, the google calendar returns an <author> key with 2 subkeys <name> & <email>, how can I grab these sub keys and output to a placeholder in my tpl chunk?
so far it works OK, but could use some love.
-thanks
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Hi Chaps;
you have to specify an output chunk - the default is to just dump the array if no chunk is specified,
Here’s what I have for my google calendar feed:
note the tpl...
[[!getFeed?
&url=`http://www.google.com/calendar/feeds/info.oncologyeducation%40gmail.com/public/basic`
&limit=`12`
&tpl=`GoogleCalendarFeed`
]]
this is the GoogleCalendarFeed chunk, the "IF" is just filtering out private items.
[[!If?
&subject=`[[+title]]`
&operator=`EQ`
&operand=``
&then=`[[+title]]`
&else=`
<div class="google-calendar">
<ul>
<li><a href="[[+link]]"><h5>[[+title]]</h5></a></li>
<li>[[!ParseGoogleSummary? &input=`[[+summary]]`]]</li>
</ul>
</div>
`
]]
Note the variables I am using there correspond to the keys you see in your array dump, i.e. you can use:’title, link, description...etc’
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Thanks Sean,
A tpl chunk has done it for me. Thanks for the example.
Chaps
I was just updating my site to use getFeed with google calendar and thought this might be useful to someone following this thread.
You can add the following query parameter to your feed URL:
Full sorting/filtering options are here:
http://code.google.com/apis/calendar/data/2.0/reference.html#Parameters
I also wanted to reverse the order of the events which I did by adding this code to the getFeed snippet around line 45, although I’m sure there’s a better way to "parameter-ize" this:
$output = array_reverse($output);
stevesunderland.com
GRAPHICS | INTERACTIVE | MARKETING
xhtml + ajax + seo websites powered by modx
Nice find Steve ... thanks, this will be useful.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Hi Sean. If possible, would you mind sharing that [[!ParseGoogleSummary? snippet you referenced? Thanks for your replies and info on this thread.
Hi everyone. I hope someone can help. I'm trying to display an rss feed with getfeed but I'm receiving this error:
Warning: MagpieRSS: Failed to fetch app.mysquawkbox.com/feed/w7IZLIGoMJOpWt--pdbd++g==%250A.rss (HTTP Error: Invalid protocol "") in /home/yorkweb1/public_html/shepherdbeamish/core/model/modx/xmlrss/rssfetch.class.php on line 237
Here is my snippet call:
[[!getFeed? &url=`app.mysquawkbox.com/feed/w7IZLIGoMJOpWt--pdbd++g==%250A.rss`]]
Also tried:
[[!getFeed? &url=`http://app.mysquawkbox.com/feed/w7IZLIGoMJOpWt--pdbd++g==%250A.rss`]]
Does anyone know how to fix this? Many thanks for your help.
I'm getting the same error! Not sure why. Works fine with other feeds.. just the google cal xml feed.