Skip to content

Commit

Permalink
[TASK] Add inline syntax to Fluid syntax (#1949)
Browse files Browse the repository at this point in the history
Some content was migrated from the Extbase book but has been
considerably shortened.

Related: TYPO3-Documentation/TYPO3CMS-Book-ExtbaseFluid#536

Co-authored-by: Sybille Peters <sypets@gmx.de>
  • Loading branch information
github-actions[bot] and sypets authored Jul 12, 2022
1 parent 35a16e5 commit 4a1d2cc
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Documentation/ApiOverview/Fluid/Syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,50 @@ curly braces:
:caption: EXT:site_package/Resources/Private/Templates/SomeTemplate.html

Now it is: <f:format.date format="{format}">{date}</f:format.date>

Fluid inline notation
=====================

.. tip::

There is an online converter from tag-based syntax to inline syntax:
`Fluid Converter <https://fluid-to-inline-converter.com/>`__

An alternative to the tag based notation used above is inline notation. For
example, compare the 2 identical Fluid constructs:

.. code-block:: html
:caption: EXT:my_extensions/Resources/Private/Templates/Something.html

<!-- tag based notation -->
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive"/>

<!-- inline notation -->
{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive')}

Tag based notation and inline notation can be freely mixed within one Fluid
template.

Inline notation is often a better choice if HTML tags are nested, for example:

.. code-block:: html
:caption: EXT:my_extensions/Resources/Private/Templates/Something.html

<!-- tag based notation -->
<span title="<f:translate key='LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive'/>">

<-- inline notation -->
<span title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive')}">

More complex example with chaining:

.. code-block:: html
:caption: EXT:my_extensions/Resources/Private/Templates/Something.html

<!-- tag based notation -->
<f:format.padding padLength="40"><f:format.date format="Y-m-d">{post.date}</f:format.date></f:format.padding>

<!-- inline notation -->
{post.date -> f:format.date(format: 'Y-m-d') -> f:format.padding(padLength: 40)}


0 comments on commit 4a1d2cc

Please sign in to comment.