Proper Fluid Templating in TYPO3

时间:2015-10-06 08:55:04

标签: typo3 templating

My question deals specifically with connecting backend layouts and content elements and how to properly integrate them into the main content area of a website. Here is my current setup:

TYPO3 7.4 using the FLUID templating engine
Dynamic Content Elements (DCE) extension installed.

I have already placed elements such as the header and footer into partials and they are loaded into the main template via FLUID. I am currently stuck trying to figure out how I should template the main content area. It consists of one column, between the header and footer, but should contain different configurations of elements.

For instance, say for the first block, I would like a header followed by a row of 3 boxes placed side by side. In the second block, a header followed by a row, in which an arbitrary amount of boxes can be displayed, but at one time, only four (thus the user would have to horizontally scroll to see the others). It should look something like this:

http://i.stack.imgur.com/cGosd.png

First attempt at a solution: I created the DCEs and a backend layout with two columns. Each column serves as a an input area for the two rows seen in the image. Then, I modified the Typoscript template to access these columns with colPos and saved them in variables using styles.get.content. Using FLUID, I could then implement them in the template and they could be outputted.

First of all, I have no idea if this is a valid usage of backend layouts, but I have a feeling that this is not how they were intended to be used. The columns are not truly columns, simply a means to target them with Typoscript, and thus have nothing to do with the structure of the page. Secondly, this method seems to be inefficient, since should I want to add another row to the page with other characteristics, the backend layout would have to changed to accommodate this. Thirdly, other pages could have varying amounts of these rows, which are essentially used to group elements. Depending on how complex the site becomes, this could mean many background layouts.

In sum, the question posed is:

  1. Is this solution proper, and if not, how does one group elements in TYPO3 to achieve the explained goal?

1 个答案:

答案 0 :(得分:0)

您应该尝试扩展" Gridelements"。版本4仅适用于Github,但适用于TYPO3 7.x。

我的建议:

  1. 使用一个后端布局,只有一列"主要内容"。
  2. 在Gridelements中定义您的网格,对于您的情况,您需要一个3列网格和一个4列网格。 (查看手册进行配置)
  3. 在您的网页上和您的DCE网格中插入网格。
  4. 我主要使用不同的后端布局来启用/禁用侧边栏或分隔上下内容区域......