The Views module in Drupal provides a Feed display that will allow for site owners to publish the content on their sites as RSS feeds. However, unlike a page or block display, the feed display does not allow for addition of custom tags inside the feed using the Views administration UI. There is however a way to add custom tags, attributes and values into the generated feed using hook_nodeapi.
Hook_nodeapi supports an 'rss item' operation which gets called whenever an item is inserted into the feed during the generation of a feed. The corresponding nodeapi call can be used by modules to insert custom tags to the feed.
For example, by inserting the following 'rss item' case to the nodeapi hook in a module
case 'rss item':
$custom_tags = some_function_call();
$rss_items = array();
$rss_items[] = array(
'key' => 'key_name',
'attributes' => array(
'attribute1_name' => $attribute1_value,
'attribute2_name' => $attribute2_value,
),
'value' => $key_value,
);
return $rss_items;you will be able to insert a tag
<key_name attribute1_name="attribute1_value" attribute2_name="attribute2_value">key_value</key_name>For the 'rss item' nodeapi hook the function should return an array of items that are to be inserted corresponding to each node in the feed. Each item in the array should be an array of one key, zero or more attributes and optionally a value.
For more complex capabilities you will have to use the Feeds module instead of the default core feed functionality.



Comments
Wow! Thank you! I always
Amada Spallina (not verified) wrote on July 12, 2010 - 12:32Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Code Error
Mayank (not verified) wrote on February 23, 2010 - 14:36'value' => $key_value;
should be
'value' => $key_value,
Thanks,
Thanks for the correction
webmaster wrote on February 28, 2010 - 23:35Thanks for the correction. I have duly made changes.
Anoop John
Customize RSS Feeds generated by Views2 in Drupal 6
linkwheel (not verified) wrote on January 18, 2010 - 13:59For more complex capabilities we will have to use the Feeds module instead of the default core feed functionality is illustrated well in the article....
You are right
webmaster wrote on February 28, 2010 - 23:35Yes, You are right about the Feeds module but if the only requirement is to add custom tags to nodes in feeds then the core feed should work fine too.
Anoop John