我是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.
我总是使用这篇文章: www. typo3wizard/en/articles/explaining-the-content-object.html
I always use this article: www.typo3wizard/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.
更多推荐
将页面内容添加到流体模板
发布评论