TYPO3 Content Elements based on Fluid

Extension key

fluid_styled_content

Package name

typo3/cms-fluid-styled-content

Version

12.4

Language

en

Author

TYPO3 contributors

License

This document is published under the Open Content License.

Rendered

Tue, 08 Jul 2025 09:21:39 +0000


This extension provides Fluid templating for TYPO3 content elements.


Table of Contents:

Introduction

What does it do?

fluid_styled_content handles the rendering of TYPO3's default content elements and comes bundled as part of the Core. These content elements are rendered using the Fluid templating engine.

These content elements can be used as-is and can also be modified depending on your requirements. You are not bound to using only these content elements. It is possible to add new content elements to the existing set. This document details how to use, adapt, enhance and create new content elements.

Optionally fluid_styled_content offers basic CSS that takes care of positioning content according to fields chosen in the backend.

For example, if you create a content element of type Text with Images with a centered headline, a subheader, some text and an image with the position in text, right:

The output of the HTML is rendered by the Fluid template typo3/sysext/fluid_styled_content/Resources/Private/Templates/Textpic.html which in turn includes several partials.

See the following, shortened code example:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="Header">
    <f:render partial="Header/All" arguments="{_all}" />
</f:section>
<f:section name="Main">

    <div class="ce-textpic ce-{gallery.position.horizontal} ce-{gallery.position.vertical}">
        <f:render partial="Media/Gallery" arguments="{_all}" />

        <f:if condition="{data.bodytext}">
            <div class="ce-bodytext">
                <f:format.html>{data.bodytext}</f:format.html>
            </div>
        </f:if>
    </div>

</f:section>
</html>
Copied!

The HTML output then looks like this:

<div id="c1" class="frame frame-default frame-type-textpic frame-layout-0">
  <header>
    <h2 class="ce-headline-center">
      A centered headline
    </h2>
    <h3 class="ce-headline-center">
      A subheader
    </h3>
  </header>
  <div class="ce-textpic ce-right ce-intext">
    <div class="ce-gallery" data-ce-columns="1" data-ce-images="1">
      <div class="ce-row">
        <div class="ce-column">
          <figure class="image">
          <img class="image-embed-item"
            src="/fileadmin/user_upload/TYPO3.png" width="280" height="280" loading="lazy" alt="">
          </figure>
        </div>
      </div>
    </div>
    <div class="ce-bodytext">
      <p>Lorem ipsum dolor sit...</p>
    </div>
  </div>
</div>
Copied!

If the default CSS provided by this extension was also included, the output could look like the following in the browser:

A little bit of history

In early years, TYPO3's content elements were rendered by the Typoscript set called content (default). This was mainly based on font-tags for styling and tables for positioning which was needed to achieve the visual constructions in old versions of web browsers.

Some time later the extension css_styled_content was introduced, which focused on reducing the amount of TypoScript and providing XHTML/HTML5 markup which could be styled by Cascading Style Sheets (CSS), a style sheet language used for describing the look and formatting of a document written in a markup language. Still this extension was heavily based on TypoScript and did allow custom modifications up to some point.

Since the introduction of the Fluid templating engine, more websites are using this for page templating. Newer TYPO3 CMS packages (extensions) are also using Fluid as their base templating engine. The content elements which were provided with TYPO3 CMS by default were still using TypoScript and some PHP code.

Since TYPO3 7.5 the default content elements are provided by the extension fluid_styled_content and thus use Fluid as template engine. The main benefit being that hardly any knowledge of TypoScript is now needed to make changes. Integrators can easily exchange the base content element Fluid templates with their own. With Fluid, more complex functionality that exceed the simple output of values has to be implemented with ViewHelpers. Every ViewHelper has its own PHP class. Several basic ViewHelpers are provided by Fluid. When using your own Fluid templates, developers can add extra functionality with their own ViewHelpers.

Installation

This extension is part of the TYPO3 Core.

Table of contents

Installation with Composer

Check whether you are already using the extension with:

composer show | grep fluid-styled-content
Copied!

This should either give you no result or something similar to:

typo3/cms-fluid-styled-content       v12.4.11
Copied!

If it is not installed yet, use the composer require command to install the extension:

composer require typo3/cms-fluid-styled-content
Copied!

The given version depends on the version of the TYPO3 Core you are using.

Installation without Composer

In an installation without Composer, the extension is already shipped but might not be activated yet. Activate it as follows:

  1. In the backend, navigate to the Admin Tools > Extensions module.
  2. Click the Activate icon for the Fluid Styled Content extension.
Extension manager showing Fluid Styled Content extension

Extension manager showing Fluid Styled Content extension

Next step

Include the default TypoScript file.

Include the default TypoScript set

To use the default rendering definitions provided by fluid_styled_content, you have to add the extension's TypoScript set to your root TypoScript record.

When you are using a site package you can add the following lines to your site packages constants.typoscript and setup.typoscript:

my_sitepackage/Configuration/TypoScript/constants.typoscript
# Import the default constants of EXT:fluid_styled_content
@import 'EXT:fluid_styled_content/Configuration/TypoScript/constants.typoscript'
Copied!
my_sitepackage/Configuration/TypoScript/setup.typoscript
# Import the default setup of EXT:fluid_styled_content
@import 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript'

# Import the default CSS of EXT:fluid_styled_content
@import 'EXT:fluid_styled_content/Configuration/TypoScript/Styling/setup.typoscript'
Copied!

This is the recommended way as the import of TypoScript can be kept under version control this way.

Alternative: Include the TypoScript set in the root TypoScript record

It is also still possible to include the TypoScript set directly into a TypoScript record. However there are draw backs: The import is then stored in the database and not the file system and cannot be kept under version control.

Edit the whole TypoScript record

  1. Go to the module Web > TypoScript.
  2. In the page tree, select the page which contains the root TypoScript record of your website.
  3. Select Edit TypoScript Record in the dropdown at the top of the Web > TypoScript module.
  4. Click the Edit the whole TypoScript record. This will open all the settings of the root TypoScript record:

Include the Fluid Content Elements TypoScript file

Go to the tab Includes and select Fluid Content Elements in the Available items under Include TypoScript sets. The selection will move to the Selected items.

TYPO3 is now using the rendering definitions of fluid_styled_content for the default set of content elements. This is essentially unstyled HTML5 markup.

You can additionally select Fluid Content Elements CSS (optional). This TypoScript set adds some CSS styling to make sure all the parts of a content elements have some styling, this will include alignment and positioning. This set of styles will not add any colors, make any changes to typography or anything else related to your website's visual style. This TypoScript set is optional, as it is common for integrators to override the basic styling.

Save the TypoScript record by using the save button at the top of the module.

Next step

Display the content elements in your site package template.

Inserting content in your page template

To get the different columns from the backend displayed in the frontend you can use predefined CONTENT objects or the DatabaseQueryProcessor.

It is advised to make all your changes in a custom extension, visit the site package documentation to find out more.

Based on the FLUIDTEMPLATE content object (cObj)

lib.dynamicContent = COA
lib.dynamicContent {
   10 = LOAD_REGISTER
   10.colPos.cObject = TEXT
   10.colPos.cObject {
      field = colPos
      ifEmpty.cObject = TEXT
      ifEmpty.cObject {
         value.current = 1
         ifEmpty = 0
      }
   }
   20 = CONTENT
   20 {
      table = tt_content
      select {
         orderBy = sorting
         where = {#colPos}={register:colPos}
         where.insertData = 1
      }
   }
   90 = RESTORE_REGISTER
}

page = PAGE
page {
   10 = FLUIDTEMPLATE
   10 {
      templateName = Default
      templateRootPaths {
         0 = EXT:example_package/Resources/Private/Templates/Page/
      }
      partialRootPaths {
         0 = EXT:example_package/Resources/Private/Partials/Page/
      }
      layoutRootPaths {
         0 = EXT:example_package/Resources/Private/Layouts/Page/
      }
   }
}
Copied!
<f:layout name="Default" />
<f:section name="Main">
   <f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: '0'}" />
</f:section>
Copied!

Next step

You can start adding content elements or make further configurations.

Configuration

Configuring content elements can be done for the frontend and the backend.

The easiest way to change the appearance of content elements in the frontend is by using the Constant Editor*`. These settings are global, which means they are not configurable in a single content element. Constants are predefined.

TYPO3 uses TypoScript as a configuration language and is used by the frontend rendering. By overriding TypoScript you can modify the rendering for most of the frontend.

For the backend, fields can be shown or hidden, depending on the fields you are using or the fields an editor is allowed to use. Configuration like this is done using Page TSconfig or User TSconfig.

Constant Editor

Include the Fluid Content Elements TypoScript file

  1. The Constant Editor can be found in the Site Management > TypoScript module.
  2. Select the page in the page tree which contains the root Typoscript record of your website.
  3. Select Constant Editor in the dropdown at the top of the Site Management > TypoScript module.
  4. In the dropdown list select the category CONTENT.
  5. This will give you a list with all the constants of this extension. All constants are described and can be edited by clicking the pencil in front of the current value or by editing the available field.
  6. Do not forget to save the new values. The new values will be stored in the "Constants" field of the root template of your website.

TypoScript

At the section Include the default TypoScript set you've already added the TypoScript sets. TypoScript sets are a collection of TypoScript files. These files are located in the directory EXT:fluid_styled_content/Configuration/TypoScript/.

Structure of the TypoScript files

Structure of the TypoScript files

In this folder there are two files:

  • constants.typoscript - The file with the default constants. The Constant Editor, as described above, is using this file for its default settings.
  • setup.typoscript - This file will first include some other files which are located in the Setup/ folder in the same directory. More about these files later.

In the folder ContentElement/ there are files which are included by the file setup.typoscript as mentioned above. These files contain the rendering definitions of all content elements that are provided by the TYPO3 Core. These are:

  • Bullets.typoscript - Configuration for content element "Bullet List"
  • Div.typoscript - Configuration for content element "Divider"
  • Header.typoscript - Configuration for content element "Header Only"
  • Html.typoscript - Configuration for content element "Plain HTML"
  • Image.typoscript - Configuration for content element "Image"
  • List.typoscript - Configuration for content element "General Plugin"
  • MenuAbstract.typoscript - Configuration for content element "Menu of subpages of selected pages including abstracts"
  • MenuCategorizedContent.typoscript - Configuration for content element "Content elements for selected categories"
  • MenuCategorizedPages.typoscript - Configuration for content element "Pages for selected categories"
  • MenuPages.typoscript - Configuration for content element "Menu of selected pages"
  • MenuRecentlyUpdated.typoscript - Configuration for content element "Recently updated pages"
  • MenuRelatedPages.typoscript - Configuration for content element "Related pages (based on keywords)"
  • MenuSection.typoscript - Configuration for content element "Section index (page content marked for section menus)"
  • MenuSectionPages.typoscript - Configuration for content element "Menu of subpages of selected pages including sections"
  • MenuSitemap.typoscript - Configuration for content element "Sitemap"
  • MenuSitemapPages.typoscript - Configuration for content element "Sitemaps of selected pages"
  • MenuSubpages.typoscript - Configuration for content element "Menu of subpages of selected pages"
  • Shortcut.typoscript - Configuration for content element "Insert records"
  • Table.typoscript - Configuration for content element "Table"
  • Text.typoscript - Configuration for content element "Regular Text Element"
  • Textmedia.typoscript - Configuration for content element "Text and Media"
  • Textpic.typoscript - Configuration for content element "Text and Images"
  • Uploads.typoscript - Configuration for content element "File Links"

Since we move away from TypoScript as much as possible, these rendering definitions only declare the following:

  • Can FLUIDTEMPLATE be used immediately or do we need data processing first?

    A processor is sometimes used to do some data manipulation before all the data is sent to the Fluid template.

  • Assigning the Fluid template file for each type of content element separately.

In the folder Helper/ there are files which are included by the file setup.typoscript as mentioned above. These are:

  • ContentElement.typoscript - Default configuration for content elements using FLUIDTEMPLATE
  • ParseFunc.typoscript - Creates persistent ParseFunc setup for non-HTML content

Overriding the Fluid templates

At TypoScript we have described the way content elements are rendered.

By default these settings are done in the setup.typoscript file which can be found in the EXT:fluid_styled_content/Configuration/TypoScript/ folder.

Using lib.contentElement

This option gives you the ability to add another templateRootPath and can be defined the same as partialRootPaths and layoutRootPaths:

lib.contentElement {
   templateRootPaths {
      200 = EXT:your_extension_key/Resources/Private/Templates/
   }
   partialRootPaths {
      200 = EXT:your_extension_key/Resources/Private/Partials/
   }
   layoutRootPaths {
      200 = EXT:your_extension_key/Resources/Private/Layouts/
   }
}
Copied!

A content element is using a templateName, which is defined in setup.typoscript. You can override this value, but the template from the extension fluid_styled_content will not be loaded as its name is still the default value.

tt_content {
   bullets {
      templateName = ChangedName
   }
}
Copied!

The content elements

Typical page content

This chapter describes the default set of content elements provided by TYPO3's Core. It will show you a description and screenshots of the backend fields.

General fields

These are fields which are used by (almost) every content element.

Show in Section Menus

Using this option will only be visible when using menu's based on sections. This will be described in the chapter Menus.

This field can be found in the Appearance tab.

The field "Show In Section Menu's"

A Section Menu, which is in turn a content element itself produces an output including the headlines of all content elements with the flag Show in Section Menus set.

Access

The Access tab with all its fields

These fields define if and when a visitor has access to this content element. The access fields all reside in the Access tab:

Visibility of content element
By checking this option the content element will not be visible to any visitor.
Publish Date
The date on which the content has to be published, which means making visible at a certain date.
Expiration Date
The date on which the content will be expired, which means the content will be hidden on a certain date
Usergroup Access Rights
Here you can select whether the content element only is available to a certain frontend user group, if it has to be visible only when the visitor is logged in or if it has to be hidden at a login.

Text & Images

Typical page content: Text, Images and Media

This content element allows you to combine text and images. Additionally there is also a content element for Text & Media where you can use videos or Audio. There are also separate content elements for Text or Images individually. These offer no advantage over the content element Text & Images except that some fields are missing and the backend form is less cluttered.

The text can be entered in the rich text editor of the General tab.

The content element rich text editor in the content element Text

The media elements can be added in the Images tab. In this tab there is also the option to turn the enlarge on click behaviour on for images.

TextImages in the content element Text & Images

Multiple images and movies are combined as a gallery, which can be configured using the Gallery Settings. In some installations there are specific settings for width or height for each element, if a border should be shown around each element, the position of the gallery in relation to the text and the amount of columns which should be used for the gallery.

The maximum width of the gallery can be different when the gallery is on top or bottom of the text, or inside the text. This can be set using the Constant Editor.

Bullet list

Typical page content: Bullet List

With this content element you can provide unordered and ordered bullet lists, but also a definition list, in the frontend.

The most important fields of the content element

The type of list can be defined with the field Type of bullets.

The content is added in the field Bullet List, where each new line is a new bullet.

Bullet 1
Bullet 2
Bullet 3
Copied!

For definition lists you use one line for a single definition which starts with the term, followed by the description, separated by a vertical bar "|".

Term 1|Description 1
Term 2|Description 2
Term 3|Description 3
Copied!

Table

Typical page content: Table List

The Table content element can be used to display tabular data.

The content element Table in the backend

By default the Field delimiter is a vertical bar "|", the Text enclosure set to none.

A Table caption can be provided as a heading for the table.

The content element Table in the backend, tab Appearance

Also some appearance options are available for the table. These can be found in the Appearance tab:

Columns
The maximum amount of columns. Even when more columns are defined in the Table content field, the table will only show the maximum amount of columns.
Table class
Some predefined classes to style the table output.
Table header position
The first row or the first column can be used as a table header.
Use table footer
The last row will be used to group the table's footer area (which may be a summary, an addition of column values, or some call to action based on the preceding content).

Insert Records

Insert records page content

Ever have content on one page that you want to reference on another page? But you don't want to have to maintain both and keep them both in sync? And you don't want to show the whole content from one page on another. Using insert records you can add one content element from a page or all the content elements from a page. You can also add content elements from several pages.

The content element Insert Records

Just select the content elements you want to display and if necessary, put them in the right order.

In the frontend the referenced content elements will show up the same as the original one (if the styling is not different for that page)

Insert plugin

Plugin content elements

Extensions often provide plugins to render frontend output. They are essentially the same as content elements. When an extension depends on a plugin, select the plugin in this content element. The fields might change depending on the plugin.

For example, the system extension indexed_search provides the Indexed Search plugin which does not offer any additional fields:

The plugin Indexed Search

Divider

Divider page content

Nothing more than a horizontal rule.

HTML

Plain HTML page content

The content element Plain HTML in the backend

Insert HTML directly using this content element.

Adding Your Own Content Elements

Sitemap