Page 1 of 1

RSS2HTML - extracting enclosure info from rss feed

Posted: Tue Jan 08, 2013 6:46 am
by stevegos
Hi

I have a rss feed which contains an element called enclosure which contains a URL to an image:

<enclosure url="http://www.domain.co.uk/images/beer/thu ... c-5825.jpg" length="3800" type="image/gif"/>

I put the following in the template but it does not output the URL:

<img src="{$item.enclosure}">

Any ideas how to get this to work? All help greatly appreciated.

Steve

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Tue Jan 08, 2013 10:02 pm
by Rolf
Never used it, but in the img tag I see jpg *and* a gif call. Might be in conflict...

Rolf

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Wed Jan 09, 2013 11:21 am
by stevegos
Thanks for that.

I did notice that but the same rss feed is being used by numerous other web sites who are able to display the jpg image fine and the guy that provides the feed says no one else is reporting any problems.

Steve

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Wed Jan 09, 2013 5:57 pm
by uniqu3
It doesn't output url as {$item.enclosure} is empty <enclosure/> has no value, what you need is target for enclusre attrubte called url where url is speficied.
Do {$item.enclosure|print_r} and see if array or object or anything that you can target is returned at all, so it would be array you could do {$item.enclosure.url} probably.

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Thu Jan 10, 2013 11:26 am
by stevegos
Thanks uniqu3

{$item.enclosure|print_r} simply outputs the number 1 in every instance. Since my OP I have tried several variations {$item.enclosure.url} but it does not output anything.

Steve

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Sun Mar 03, 2013 11:31 pm
by stix
Hi there - I am having the same problem extracting an enclosure... Steve did you get anywhere with this in the end?

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Mon Mar 04, 2013 8:23 am
by stevegos
Hi, No I gave up in the end as I just couldn't make it work.

Steve

Re: RSS2HTML - extracting enclosure info from rss feed

Posted: Mon Jun 24, 2013 1:51 am
by alexis
in my case i try {$item|print_r} and received the full array
then i see in array enclosure_url
case is closed ;D