RSS feeds for Views
Last modified: October 13, 2009 - 05:41
Views can have RSS feeds so that users can read the items in their news reader as they get added to the view.
- enable the "views_rss" module in administer » modules
- create or edit a view (under administer » views)
- in your view, click on the "Arguments" heading to reveal its settings
- under "Add Argument", select "RSS: RSS Feed Selector", then the "Add Argument button"
- select the default as "Display All Values"
- save the view as usual, or continue creating the view
This automatically creates an RSS feed for the view, and adds a feed icon at the bottom of the view. It also enables RSS autodiscovery for that view, so that you can just copy the URL of the view into the news reader (also some browsers will make note of the feed so that you can subscribe to it).
The feed becomes available at whatever the URL is for the view, plus "/feed".
Note: to add CCK fields in addition to the Title and Body fields you should look at the Content Template module.
Here is the code to import in Views 1.x (Drupal 5):
$view = new stdClass();
$view->name = 'user_feed5';
$view->description = '';
$view->access = array (
0 => '3',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '6';
$view->page_footer = '';
$view->page_footer_format = '6';
$view->page_empty = '';
$view->page_empty_format = '6';
$view->page_type = 'views_rss';
$view->url = 'rss/$arg';
$view->use_pager = FALSE;
$view->nodes_per_page = '5';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array (
array (
'type' => 'uid',
'argdefault' => '1',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'blog',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node);
$views[$view->name] = $view;
Argument Handling Code
You might be able to get around this by with the Argument Handling Code option in the views argument fieldset to flip your arguments around or to flip on the wild card in certain circumstances.
For me I had one argument then I added the RSS argument and only one RSS link showed up.
My view is set up as follows
viewpath/arg1/rss
When I clicked on the link on the base (viewpath/) the like was viewpath/*/rss - this returned a page not found until I went to my first argument and set the wildcard to '*' then everything worked fine.
For example I used
channel/columns/column+name
Where channel/columns is the view name and "column+name" is the name of an argument. channel/columns/*/rss gave an RSS feed of all the columns and channel/columns/column+name/rss gave the rss feed for the "column+name" column only.
I am using drupal 5.2 and views 5.x-1.6
I cannot find views_rss in
I cannot find views_rss in Drupal 6, any ideas?
Review Critical
ClipGlobe - World Travel
Drupal 6 Does RSS Feeds in Views Differently
http://drupal.org/node/314097
---
Shane Birley
Left Right Minds
http://www.leftrightminds.com
Does this only work on page output?
My view outputs to a block and I cant seem to get this to work.
rss from site node type and agregate some field valuse in RSS
created content type "News" with fields:
1. Title
2. Date
3. Short slogan
4. Short content
5. full content
6. category of news (from list of all categories)
7. type of news (from list of all news types e.g. presentation, bug report, alert and so on... )
8. source site link
9. source customer (news creator)
..
..
now i create new view, in result some type of users can see block with fields:
1. Date
2. Short slogan (with link to own node)
I plan to create RSS feed with this content:
Title of rss: !Short slogan
rss body: !source customer [static text (like publishes)] !type of news :
!date | !Short content
[static text, like YOU CAN SEE ALL] !category of news news at !category vews source link
[static, more about] !source customer. [official site of] !source site link
In result with values:
1. Title = new rss
2. Date = 2009.11.28
3. Short slogan (for block view) = cool RSS started
4. Short content (for block view) = your company's news can be faster, simpler and more viewable
5. full content = bla bla bla
6. category of news (from list of all categories) = internet
7. type of news (from list of all news types e.g. presentation, bug report, alert and so on... ) = presentation
8. source site link = www.example.com/rss
9. source customer (news creator) = ionmedia
we must have RSS:
Title:
cool RSS started
rss body:
ionmedia publishes presentation: 2009.11.28 | Your company's news can be faster, simpler and more viewable
YOU CAN SEE ALL internet news at www.exammple.com/rss/internet/
more about ionmedia. official site www.example.com/rss
please, explain me how i can create RSS from vews and how i can inject [static text] and !params from cck fields of my node
p.s.
my conf: VPS, D 6.14, cck, views and so on.
views_rss only outputs nodes?
I have a view called "comments_recent" that displays the subjects of the most recently posted comments to the site - but the RSS feed for this view outputs the nodes that were being commented on, instead.
Any suggestions?