Symfony 2 data not rendering in RSS.XML file, but the data is there in the markup code
I am creating an RSS feed for my project, and currently the file that holds the RSS data (the XML file) is like this:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>RSS Example</title>
<description>This is an example of an RSS feed</description>
<link>http://www.domain.com/link.htm</link>
<lastBuildDate>Mon, 28 Aug 2006 11:12:5开发者_C百科5 -0400 </lastBuildDate>
<pubDate>Tue, 29 Aug 2006 09:00:00 -0400</pubDate>
{% for latestnews in news %}
<item>
<title>{{ latestnews.title }}</title>
<description>{{ latestnews.content | truncate(500) | raw }}</description>
<link>../app_dev.php{{latestnews.url }}</link>
<guid isPermaLink="false">{{latestnews.url }}</guid>
<pubDate>{{ latestnews.lastedit | date('jS F Y') }}</pubDate>
<media:thumbnail width="144" height="81" url="{{ latestnews.mainImage }}"/>
</item>
{% endfor %}
</channel>
</rss>
However, when the page is viewed in the browser, everything except for the data and tags contained within the {% for latestnews in news %}
and {% endfor %}
displays. The actual latest news articles don't display. When I check the mark up code however, the latest news articles are displayed.
I've looked at other RSS feeds (such as the BBC News one) and I can't see any difference in what I've done to what they've done. Do I have to add something, a specific Symfony code, that makes it render items when it's inside a loop?
Cheers
The problem stemmed from using the <media:thumbnail>
tag. Once this was removed all of the articles displayed properly. Bizarrely, it was Internet Explorer that helped me solve it!
精彩评论