1

I'm new to TYPO3 and Fluid and trying to display the page content using a Fluid template similar to the following one:

<div id="content">
   <f:format.html>{content}</f:format.html>
</div>

The page data is entered via the backend using a two-column layout (colPos=0, colPos=1).

I am now trying to display the content of the first column (colPos=0) inside the div.
At the moment, my TYPO-Script looks like the following:

page = PAGE
page {
   # ...

   5 = FLUIDTEMPLATE
   5 {
        file = fileadmin/templates/default.html

        # ...

        variables {
           pageTitle = TEXT
           pageTitle.data = page:title    

           content = CONTENT
           content {
              table = tt_content
              select {
                 where=colPos=0
              }
              renderObj = COA
              renderObj {
                 10 = TEXT
                 10.field = bodytext
              }
           }
      }
}

It works this way, but I cannot get rid of the feeling that my 5.variables.content is way too complicated.

I saw some solutions using content < styles.content.get as an alternative but using this causes my resulting div to be empty.

Are there any more elegant ways (i.e. shorter in this context) to achieve what I am doing?

4
  • I believe content < styles.content.get needs the static TypoScript for css_styled_content to be included. Did you do that?
    – Jost
    Feb 26, 2013 at 14:25
  • Thanks for you response! "CSS Styled Content (css_styled_content)" is included in the "Include static (from extensions)" section of my template posted above. Still, the content stays empty when using styles.content.get.
    – Matthias
    Feb 26, 2013 at 17:20
  • It should be included at the top of the inclusion list. If it is somewhere down the list, the content is sometimes not rendered.
    – Jost
    Feb 26, 2013 at 18:30
  • It's the only entry. Should there be any other templates included for it to work?
    – Matthias
    Feb 26, 2013 at 21:44

4 Answers 4

2

On your question which approach is more elegant (I don't use fluid, but I think it's general Typoscript):

If you want to use css_styled_content, but with more flexibility and transparence than the shortcuts "get", "getLeft" etc., use this:

content < styles.content.get
content.select.where = colPos = 0

No need to specify content = CONTENT in that case.

In the way you wrote it above, you would probably need to add:

10.parseFunc = < lib.parseFunc_RTE

to your renderObj, as else, automatically linked e-Mail addresses etc. won't be rendered in the content.

If you want full control over the markup, your original approach using the CONTENT object is superior to css_styled_content. But you will have to cover each field the editors are supposed to use.

I always use this article: http://www.typo3wizard.com/en/articles/explaining-the-content-object.html

With css_styled_content on the other hand, you get parsing for all fields for free - but also you get all the markup it will write for you.

It might be helpful to look at csc's static template in /typo3/sysext/css_styled_content/static/setup.txt to see what it does.

5
  • Thanks for your response! When replacing the CONTENT value with content < styles.content.get, however, the content is not inserted probably; my div simply stays empty.
    – Matthias
    Feb 26, 2013 at 21:45
  • can you try outputting styles.content.get without the template? just page.10 = TEXT and page.10 < styles.content.get or similar
    – Urs
    Feb 27, 2013 at 9:52
  • The result is also empty (when trying to add a wrap, not even that one is outputted - outputting plain text at the same location works, however) - styles.content.get doesn't seem to get filled correctly. Is there anything I need to setup to get css_styled_content working in addition to including it as I have described in the comments of the starting post?
    – Matthias
    Feb 27, 2013 at 17:38
  • This should really be working out of the box. Which version are you on? What else. Maybe delete that template and start anew. Check "Root level", "Delete Constants, Setup" in the template and of course select the template. Check "Use as root page" in the Page settings of the root page. Check if csc extension is installed (well, it is,else the template wouldn't appear...). You could also check out the introduction package which comes with all the templates.
    – Urs
    Feb 27, 2013 at 21:48
  • And can you show the TS of the non-fluid page template? Ah, and check if the content you want to output is really in col 0! It should be, according to your template in the starting post, but who knows
    – Urs
    Feb 27, 2013 at 21:51
0

i dont use fluid, just plain TS for my projects, but i hope ill help.

In backend the cols are like this if u have not "touched" em:

| col1(Left) | col0(Normal) | col2(Right) | col3(Border) |

What i do is this for "normal" layout:

page.10 = TEMPLATE
page.10 {
  subparts{
    LEFT-CONTENT < styles.content.getLeft
    CONTENT < styles.content.get
    RIGHT-CONTENT < styles.content.getRight
  }
  marks {
    DESCRIPTION < styles.content.getBorder
  }

If u need something more u can use something like this to generate some content that is not on that page and can use it to display it on all pages.

subparts{
LEFT-CONTENT < styles.content.getLeft
LEFT-CONTENT {
  select.pidInList = 50
  select.where = colPos=0
  select.orderBy = sorting
  wrap = <div class="col100">|</div>
}
0

page.5.variables.content < styles.content.get

Of course you must have the CSS styled content extension installed (default) and the static template "CSS Styled content" included in your TypoScript Template (Tab: Includes).

0

Alternative solution: https://fluidtypo3.org/viewhelpers/vhs/development/Content/RenderViewHelper.html (along with get and random get/render counterparts).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.