Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 917 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you modify the fields output in Drupal's RSS Feeds

#1
Trying to modify the RSS feeds created by Views module in Drupal.

Since there are no 'theme_' hooks for the RSS feeds (rightfully as XML is theme-less), I need an alternate way to modify the fields that are output into the RSS, preferably using template.php if possible.

[To see links please register here]

looks promising as that is where each row is created, but it doesn't

<code>node_feed()</code> is what collects the nodes, creates the additional fields, and then calls <code>format_rss_item()</code>.

Specifically, we need to remove the <code>dc:creator</code> element from the <code>$extra</code> array created in <code>node_feed()</code>
Reply

#2
I'd suggest using the [Views Node Feed][1] module to do this. It will let you completely write the XML that is output by Views for feeds.


[1]:

[To see links please register here]

Reply

#3
In the view, if you click on "style information" this will show you the template files used to create the feed. You can copy the template so that it is overridden for your view and remove dc:creator from the `$item_elements` array.

This is not particularly nice as you are modifying data in the theme layer, but it will do what you want.
Reply

#4
I am adding another answer, as I have recently had to do this and managed to do it without modifying data in the theme layer.

You can add a preprocess function to your view. It is a bit of work though.

There are some [guidelines here][1], but they are a bit confusing. Here is my summary of how to do this.

First make sure your modules weight is > views

Secondly copy the template you would like to add a preprocessor to to your modules directory. Rename it to be something in the list of templates in theming information.

Then edit hook theme like this (but change to use the existing view that you need to override.




function mymodule_theme($existing, $type, $theme, $path) {
// Copy the exsisting views theme from the existing array.
$override = $existing['views_view_row_rss'];
// Add my preprocessor to the list of preprocess functions
$override['preprocess functions'][] = 'mymodule_myfunction';
// Point to a template so that this view will be used.
$override['template'] = 'my_more_specific_template_name';
$override['path'] = drupal_get_path('module', 'path');
unset($override['file']);
// Return your theme handler.
return array('my_more_specific_template_name' => $override);
}


You should then be able to write your preprocess code in the function mymodule_myfunction.




[1]:

[To see links please register here]

Reply

#5
If you go into a specific content type, you can set the RSS display fields as per this post:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through