1776 Posts in 498 Topics by 533 members
Blog Module
SilverStripe Forums » Blog Module » [Solved] RSS Feed - Not rendering html correctly
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 492 Views |
-
[Solved] RSS Feed - Not rendering html correctly

1 May 2012 at 9:32pm Last edited: 1 May 2012 9:33pm
Hey Guys,
I am currently trying to render an RSS Feed which contains html elements. I have duplicated and editted the RSS Widget that comes with the Blog module by changing this line:
$desc->setValue(strip_tags($item->get_description(),"&"));
for this line:
$desc->setValue($item->get_description(html));
This has left in the html that the strip_tags command was taking out, but is rendering the "< >" as "< >".
In the template that is rendering the description I have tried this:
<ul class="Articles">
<% control FeedItems2 %>
<li class="$EvenOdd<% if First %> first<% end_if %><% if Last %> last<% end_if %>">
<h4><a name="Article-0$Pos"></a>$Title</h4>
$Description
</li>
<% end_control %>
</ul>and this
<ul class="Articles">
<% control FeedItems2 %>
<li class="$EvenOdd<% if First %> first<% end_if %><% if Last %> last<% end_if %>">
<h4><a name="Article-0$Pos"></a>$Title</h4>
$Description.EscapeXML
</li>
<% end_control %>
</ul>But it still isn't rendering the html correctly.
Any help would be much appreciated!
Thanks again.
-
Re: [Solved] RSS Feed - Not rendering html correctly

1 May 2012 at 10:01pm
Solved!
By adding HTML in front of Text when defining the $desc variable:
From:
$desc = new Text('Description');
to:
$desc = new HTMLText('Description');
before this line in the RSSWidget.php file
$desc->setValue($item->get_description());
| 492 Views | ||
|
Page:
1
|
Go to Top |

