Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.11
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 May 2008 at 22:15 UTC
Updated:
18 Oct 2013 at 08:41 UTC
Hi,
I'm trying to place a link to my RSS feeds (generated by views_rss) in a sidebar block. I have the RSS icon below the view, so could manually link to each specific node, but I don't want to have to do this for each view produced. I'm no good with php, so was wondering if you could suggest some code that could achieve this?
So basically I either want to remove the RSS icon from below the view and place it in a block instead, or want a way of creating a dynamic link to the feed URL that could be used in a block (with or without the RSS icon below the view).
I hope that just about makes sense. The solution is no doubt simple, but I just cannot figure it out!
Comments
Comment #1
edpaff commentedJust to follow up...
It seems that the views_rss module prints its feed icons through page.tpl.php. The feed icons are printed through this code
<?php print $feed_icons; ?>but when you try to enter this code in a block it doesn't seem to work.Can anyone suggest any alternative?
Comment #2
merlinofchaos commentedIn your block-view.tpl.php you can try this:
Note. This is untested, so you may have to fiddle with it a bit.
Comment #3
edpaff commentedThanks for the reply,
Have given it a go, and unfortunately have had no luck. Have fiddled as suggested but am getting an error:
warning: Invalid argument supplied for foreach() in /home/mysite/public_html/mysite/modules/views/modules/views_node.inc on line 846.
The feed icon shows, but the link is to the page URL rather than the RSS URL...
Thanks again for trying.
Comment #4
Florent Jousseaume commentedHi
I just find a solution for this problem.
After searching why this snippet does not work, I find with the debug module. When you have more than 1 block generated by the view module, the current_view variable is not the block view's...
Here is my soluce
It perhaps exists a simpler soluce, but it works fine for this case :)
Florent,
Comment #5
Scott.Champion commentedHi you guys,
I'm having the same issue. I want to make the Syndicate link on each page access the RSS feed generated by Views. I'm new to drupal and tried to find the file you're talking about "block-view.tpl.php" in a search and didn't find it. I added it to my theme's directory, but it hasn't had any effect.
I'm using a derivative of the zen theme. Can you help me get my bearings?
Thanks so much, in advance!
Scott,
Comment #6
Florent Jousseaume commentedHi,
This file doesn't exist by default. You can copy the block.tpl.php with the name block-view.tpl.php
All blocks generated from a view would be concerned by this template, so you can apply a different treatment.
I hope it helps you
Florent,
(I was on holidays before, sorry for the later) (sorry for my english too !)
Comment #7
sunComment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
merilainen commentedIs this working? I cannot get it to show the feed icon inside my block. When I open the full page view, there is the feed icon showing up as it should.
Comment #10
Andrey Zakharov commentedMy solution for Views 6.x-2.x
Comment #11
anouAnd here's the code for Drupal 7 :