Add custom tag in RSS XML header Drupal 7 I'm using Views to generate a custom RSS feed. I need to add an extra tag in the header. I tried different setting in Header section of the Feed Display, but nothing gets displayed in the feed.

Could anyone explain what's the best way to do it
Maybe it's because I don't know the views module well enough but I could not get views to do this at all. Instead I created a simple module that outputs an RSS feed. Use:

header("Content-type: text/xml");
print '&lt;rss version="2.0"&gt;';


to have PHP output the correct headers.



EDIT: not sure it makes sense to just post the code but I can describe it:

1) The code below creates the page where your XML feed will live (should be in *.module file):

function xml_sender_menu() {
   $items['feed'] = array(
     'title' =&gt; 'RSS Feed',
     'page callback' =&gt; 'rss_feed',
     'access arguments' =&gt; array('access content'),
     'type' =&gt; MENU_CALLBACK,
   );

     return $items;
}


2) Then in the same file create a function called "rss_feed()" (this name should be the same as the 'page callback' =&gt; 'rss_feed', in the above array) which will contain the code that produces the actual website. The function doesn't need to return anything.

3) http://cyber.law.harvard.edu/rss/rss.html contains a good readable description of the RSS specification, use Drupal API/PHP to output the data you want into the correct fields. For example I used the node's title to fill in the &lt;title&gt; field in RSS by doing this:

$sourcetitle = htmlspecialchars($node-&gt;title);
    print '&lt;title&gt;'.$sourcetitle.'&lt;/title&gt;';


4) At the end output all the closing tags &lt;/channel&gt; &amp; &lt;/rss&gt;

I don't know what data you are trying to fill your RSS feed with, so can't really be any more specific. Finally, copy/paste the output into an RSS validator to make sure you are not missing anything.

** Something I just realized: if you are adding other fields that aren't in the RSS specification, it's no longer an RSS feed. Instead you are just getting a plain old custom XML feed, don't know if that makes a difference to you.

HTH