[TYPO3-dev] Render array of TypoScript content/objects as FLUIDTEMPLATE

Rakesh Dodda rakeshdodda.rd at gmail.com
Wed Nov 6 15:19:25 CET 2013


Hi Wouter,

I'm not sure how far this will help you, but I think you are looking at VHS
viewhelpers. Using which you can do something like the following

<v:page.content.render column='1' as="content">
>     <f:for each="{content}" as="element">
>         <f:format.raw>{element}</f:format.raw>
>     </f:for>
> </v:page.content.render>


The above code will render content of the "current page" with column ID 1.
If you want to access different page's content, you can add parameter
pageUid

<v:page.content.render column='1' as="content" pageUid='75'>
> .......
> </v:page.content.render>



In your example, I see that you are wrapping page titles in <li> tags. For
this you can use ( This is basically for a menu, but it's handy)

<v:page.menu/>


You can iterate through this and wrap your titles as you want.

The documentation of VHS is very neat :
https://fedext.net/viewhelpers/vhs/1.8.2/



On Wed, Nov 6, 2013 at 11:42 AM, Wouter Beeftink <wouter at roquin.nl> wrote:

> Hi guys,
>
> I was wondering if anyone here knows if there's a way to render an array
> of TypoScript content/objects as a FLUIDTEMPLATE? What I would like to
> achieve is something like this:
>
> TypoScript:
>
> temp.myObj= CONTENT
> temp.myObj{
> table = pages
> select {
> pidInList = 1
> }
> ???
> }
>
> Fluid template:
>
> <ul>
> <f:for each="{pages}" as="page">
> <li>{page.title}</li>
> </f:for>
> </ul>
>
> I hope the example makes sense. Especially since the forum lacks syntax
> highlighting or any way to add indents afaik.
>
> This is a pretty common use case. We use TypoScript to retrieve records
> all the time and normally the renderObj would be a TEXT object or a COA
> containing the HTML needed to render the output. Now we're trying to move
> most of the HTML to fluid templates
>
> What I've gotten so far is the following example:
>
> temp.myObj = CONTENT
> temp.myObj {
>                table = pages
> select {
> ..
> }
>
> wrap.stdWrap.cObject = FLUIDTEMPLATE
> wrap.stdWrap.cObject {
> ..
> }
>
> renderObj = FLUIDTEMPLATE
> renderObj {
> ..
> }
> }
>
> This is better than having HTML mixed with TypoScript (imo) but it
> requires two seperate templates. One for rendering the "wrap", and one for
> rendering each "renderObj".
>
> Also interesting: I came across this bug report from 3 years ago by Stefan
> Frömken, which can be found here: //forge.typo3.org/issues/23853 (am not
> allowed to posts links yet). The thing he's trying to achieve seems similar
> to what I'm trying. Oddly, this ticket seems to has led to the addition of
> FLUIDTEMPLATE settings. Something that doesn't help what he's trying to
> achieve if I understand it correctly.
>
> Any help is appreciated. This would greatly improve the seperation of HTML
> from TypoScript.
>
> Kind regards,
>
> Wouter
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev




-- 
Regards,
Rakesh Dodda



More information about the TYPO3-dev mailing list