Support other RSS tags
dldege - August 26, 2008 - 20:13
| Project: | PicLens |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Right now in mediarssapi_format_item() there is no way to passing other RSS tag information like description, GUID, and so on. I wanted to do somethign like this
<?php
$item = array(
'title' => $file->filename,
'description' => $node->title . ' ' . $file->filename,
'link' => url('node/' . $node->nid, NULL, NULL, TRUE),
'thumbnail' => file_create_url($file->filepath),
'content' => file_create_url($file->filepath),
);
$items .= mediarssapi_format_item($item);
?>Description is ignored. I think it would be nice to be able to format a complete RSS tag and for that matter.

#1
It resembles a bit like this request: http://drupal.org/node/299196
I'm not sure yet how I'm going to implement it, but it will definitely happen!
More news later.
#2
Yes, its similar but I think the approach in that issue is wrong because I don't agree with using the theme layer for what I consider non-display logic. This is however just my preference. For what I described above I'd suggest using format_rss_item, http://api.drupal.org/api/function/format_rss_item/5, which is already set up to handle extra keys. All you need to add in your API layer is maybe something that formats media xlmns items to include the namespace. So in this way your modules handling of building the items is exactly the same as the method used in nodeapi rss item. Changing this would also make it easy to facilitate support for rss item as I mentioned in http://drupal.org/node/300327.
#3
Here's a patch that I think covers it and makes the RSS feed a lot more flexible.
Please review and then I think its RTBC.
#4
I think it needs some work, after applying the patch, an item in the feed looks like this:
<item><title></title>
<link></link>
<description></description>
<title>Code sprint</title>
<link>http://drupal5/node/2</link>
<media:thumbnail url="http://drupal5/files/images/DSCF0131.preview.thumbnail.JPG" />
<media:content url="http://drupal5/files/images/DSCF0131.preview.JPG" />
</item>
As you can see the title and link tag are rendered twice in the xml, I think we should change the call to format_rss_item to
format_rss_item($item['title'], $item['link'], $item['description'], $item);and also unset title, link & description from the item array. What do you think ?
#5
Yes, in fact I had that in in there and I attached the wrong patch above.
Here is the right patch.
Thanks for testing and catching this.
#6
yep, much better, rtbc!
#7
Fixed in piclens.module version 1.1.2.30
@swentel I'm not sure how I/you manage porting this to the D6 branch.
#8
This patch applies with some fuzz on Drupal 6 branch, not tested though with actual rss output (have no local installation right now), but if it's ok, apply it.
#9
changing status
#10
commited to D6 branch.
--project followup subject--
Automatically closed -- issue fixed for two weeks with no activity.
#11
Automatically closed -- issue fixed for two weeks with no activity.