A simple note on using “Fluid Display”

Tesseract is a powerful tool, combined with “Fluid Display” the possibilities are almost limitless.

Here is a simple note on how to use it to group based on a specific field.

The Query:

SELECT
  doc_cat.title AS mydocs.title,
mydocs.name,
mydocs.path,
mydocs.file_path

FROM mydocs
LEFT JOIN doc_cat_mm
ON …
LEFT JOIN
doc_cat
ON …

The Fluid Display:


<f:if condition="{datastructure.count} == 0">
<f:else>
<f:groupedFor
each="{datastructure.mydocs.records}"
as="docCategories"
groupBy="title"
groupKey="title">
{title_cat}
<f:for each="{docCategories}" as="document">
{document.title}
An example for using TypoScript inside
<f:cObject typoscriptObjectPath="lib.docFileSize" data="{document.file_size}" />
</f:for>
</f:groupedFor>
</f:else>
</f:if>

Now TyposCript will be something as below: (NOTE: make sure you use .current = 1 )
lib.docFileSize = TEXT
lib.docFileSize.current = 1
lib.docFileSize.bytes = 1
lib.docFileSize.bytes.labels = |kb|Mb|Gb

That should be it!

Some points of interest:
<f:debug>{datastructure}</f:debug>
<f:if condition=”{0: datastructure.count} == {0: ‘0’}”>

IF this didn’t work, try
<f:if condition=”{0: datastructure.tablename.count} == {0: ‘0’}”>

URLs of interest:
http://www.t3node.com/blog/combining-fluid-viewhelpers-and-typoscript-in-typo3-5-basic-examples/
http://wiki.typo3.org/Fluid

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark