将页面内容添加到流体模板

编程入门 行业动态 更新时间:2024-10-22 04:52:17
本文介绍了将页面内容添加到流体模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是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.

更多推荐

将页面内容添加到流体模板

本文发布于:2023-11-27 08:14:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:流体   模板   页面   内容

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!