将页面内容添加到流体模板 [英] Adding the page content to a fluid template

查看:71
本文介绍了将页面内容添加到流体模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是TYPO3和Fluid的新手,并尝试使用类似于以下模板的Fluid模板显示页面内容:

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>

页面数据是使用两列布局(colPos=0, colPos=1)通过后端输入的.

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

我现在正在尝试显示div中第一列(colPos=0)的内容.
目前,我的TYPO脚本如下所示:

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
              }
           }
      }
}

这种方式可以工作,但是我无法摆脱5.variables.content太复杂的感觉.

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

我看到了一些使用content < styles.content.get作为替代方案的解决方案,但是使用此方法会导致结果div为空.

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?

推荐答案

关于您的问题,哪种方法更优雅 (我不使用流体,但我认为它是一般的Typoscript):

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

如果要使用css_styled_content,但比快捷方式"get","getLeft"等具有更大的灵活性和透明度,请使用以下方法:

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

在这种情况下,无需指定content = CONTENT.

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

对于您的renderObj,自动链接的电子邮件地址等不会显示在内容中.

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

如果要完全控制标记,则使用CONTENT对象的原始方法要优于css_styled_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.

我总是使用这篇文章: http://www. typo3wizard.com/en/articles/explaining-the-content-object.html

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

另一方面,使用css_styled_content可以免费解析所有字段-而且还可以获得它将为您编写的所有标记.

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.

在/typo3/sysext/css_styled_content/static/setup.txt中查看csc的静态模板可能会有所帮助.

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.

这篇关于将页面内容添加到流体模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆