I'm trying to create a patch to the RSS module that will add the simple feed (if enabled) to the <links> section of the page, so that the simple feed is discoverable by web browsers and aggregators.
The issue I've run into is that I want to get the item's title (so that I can call the feed "Simple feed for x" where x is the name of the current item (e.g. "Simple feed for Gallery" or "Simple feed for Photo3421" if you're looking at the main gallery page or an item named Photo3421, respectively). I'm trying to do this in Callback.inc, but I'm not having much luck:
...
$block =& $smarty->_tpl_vars['block'];
$block['rss']['feeds'] = $feeds;
$block['rss']['showMore'] = !empty($feeds);
/* New code starts here */
list($ret, $rssItem) = GalleryCoreApi::loadEntitiesById($params['itemId']);
if ($ret) {
return $ret->wrap(__FILE__, __LINE__);
}
$block['rss']['itemId'] = $itemId;
$block['rss']['itemName'] = $rssItem->getTitle();
The issue seems to be that $params doesn't contain the itemId. I know from looking at other Callback.inc files (for other modules) that it can--how do I specify that I want it to?
Edit: Okay, never mind. I would have sworn I tried GalleryUtilities::getRequestVariables('itemId'); and it didn't work, but I just tried it and it works fine. :-P
Posts: 13
For anyone who wants the changes, I've attached them. The modified template is in a "local" directory, as suggested; the Callback.inc file will overwrite your current one, so back that up first.
Unzip into your modules/ directory.
Edit: I updated it to include the Simple RSS feed in the "list of RSS feeds" block as well, if the simple feed is enabled.
Posts: 22
Thanks technophole, that fixed the rss block too.
Posts: 67
I uninstalled the rss module through site admin (g2.1), uploaded your rss folder over the old one, reinstalled and activated the module. I'm using the default settings (simple feed only). I don't see the "Add live bookmark" icon in the bottom bar of firefox, like I do for gallery 1.5. Also, I singed up for a daily alert from alerts.yahoo.com for any new items, but it doesn't work. It validates in this tester tho http://feedvalidator.org/
I get alerts for gallery 1.5 but only when I add an album, and not for new items in an album.
Any fixes for these problems?
Posts: 22
Did you make sure to add the RSS Feeds block to wherever you wanted to see them? In my case I added it to the albums pages only. Even with the fix for Simple feeds you have to add the block someplace after activating the module.
Posts: 13
In addition to what CMangrum suggests, make sure the Simple RSS feed config is set to include new items: Site Admin > Export > RSS > Simple Feed Settings tab > make sure either "Items in the album" or "Items in the album and its subalbums" is selected.
Posts: 67
^ thanks!
Edit: I guess feedblitz changed something, it's working. Thanks for this essential module!
I've been trying to find an email notification system that will work, alerts.yahoo.com and feedblitz see the feed but dont send emails.
From feedblitz support:
"Your problem is simply that your feed is invalid XML. We'll look at
ensuring that we're more tolerant of the coding error in the feed,
but it is missing an opening <?xml> tag. If you fix the feed you will fid that
the emails go out as you expect.
Use this page http://www.feedblitz.com/f/f.fbz?Diagnose=151895 to test the feed."
Posts: 13
justin, according to the feed validator I used (feedvalidator.org) and the sample file provided by the W3C (http://static.userland.com/gems/backend/rssTwoExample2.xml; see http://validator.w3.org/feed/docs/rss2.html), the XML declaration isn't required.
The mod I made didn't touch any of the RSS generation code, so I'm not sure where that's located. You might look around in the .class files, particularly modules/rss/classes/RssMapHelper.class.
Posts: 22
I've noticed that names and descriptions can cause some problems if there are special characters in them. If I look at my XML feed with firefox it's pretty easy to see where it's breaking if there is a problem. I had to go in and modify the filename, description, etc. to make sure the XML rendered correctly in firefox. Could something like that cause your feed to be considered invalid?
Posts: 13
Absolutely. If there are unescaped special characters (<, >, & are the ones you mostly need to worry about) then it won't be valid XML (and thus not a valid feed).
Posts: 18
Wow, almost four years and people are still having trouble with this and needing the patch. I know because I just had to install this patch. Thank you!!!!