[TYPO3-mvc] problem with fluid template for a rss feed

Claus Due claus at wildside.dk
Fri Nov 11 13:15:44 CET 2011


Hi Kerstin,

You may want to check out the extension "fed", at least to see how a RawViewHelper is made. With it, you can do this:

<fed:raw><![CDATA[</fed:raw>CDATA'd text]]>

…to protect the <![CDATA[ part while ]]> is ignored. This should give you a) the CDATA-section in your output and b) support for inserting Fluid variables / calling other ViewHelpers to generate the CDATA tag's content.

If you use Fluid 1.4 I believe there is a <f:format.raw> which does exactly the same as <fed:raw>.

Cheers,
Claus

On Nov 11, 2011, at 1:07 PM, Kerstin Eitner wrote:

> Hi Bastian,
> 
> i want to have the following output in my rss feed:
> 
> <content:encoded>
> 	<![CDATA[<b>Today is friday!</b><a href="http://www.typo3.org">TYPO3 is fun.</a>]]>
> </content:encoded>
> 
> 
> 1. f:format.stripTags()
> If i do it like you suggested and shown in the FLOW3 Blog Example
> 
> <description>{post.content -> f:format.stripTags() -> f:format.htmlspecialchars()}</description>
> 
> then all my markups (<b><a> and so on) are stripped out.
> But for my rss feed i want to have all the markups inside, so that it looks fine in the rss reader with paragraphs, images and links.
> 
> 
> 2. CDATA
> I thought that I have to use CDATA, in order that the markup (<b> <p>)is not interpreted as rss tags.
> But if i use CDATA then the rest is ignored by fluid. That means that fluid does not render the bodytext of my newsItem. Furthermore the CDATA does not show up in the output.
> 
> This example:
> <content:encoded>
> 	<![CDATA[{newsItem.bodytext}]]>
> </content:encoded>
> 
> delivers the following output in the rss feed:
> <content:encoded>
> 	{newsItem.bodytext}
> </content:encoded>
> 
> 
> This is where i am stuck at the moment...
> 
> Anybody some other ideas to point me in the right direction?
> 
> Thanks in advance and greets
> Kerstin
> 
> 
> 
> 
> 
> Am 11.11.2011 10:59, schrieb Bastian Waidelich:
>> Kerstin Eitner wrote:
>> 
>> Hi Kerstin,
>> 
>>> In order the rss feed has the right structure and the hmtl-code is not
>>> interpreted as rss-tags, i have to wrap this into CDATA tags like:
>>> 
>>> <content:encoded>
>>> <![CDATA[<b>test</b>]]>
>>> </content:encoded>
>> 
>> Everything in CDATA tags is ignored by Fluid. As you can see from my
>> previous example, you shouldn't need CDATA tags at all.
>> have a look at the FLOW3 Blog package [1]
>> 
>> HTH
>> Bastiasn
>> 
>> 
>> [1]
>> http://git.typo3.org/FLOW3/Packages/TYPO3.Blog.git?a=blob;f=Resources/Private/Templates/Post/Index.atom.xml;h=e59c27a510e339b29f110f98b084604be79ea2b2;hb=HEAD
>> 
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list