.. include:: ../../Includes.txt
.. _templating_gs:
.. image:: ../../Images/logo_typotonic.jpg
:width: 250px
Templating
----------
Here is a quick overview of information about templating with the TypoTonic Extension:
+------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| Condition | Templating |
+============================================================+========================================================================================================+
| Include Namespace to the fluid template | ``{namespace t = Aix\Tonic\ViewHelpers}`` |
| | This namespace is auto-registered when the extension is active, *so you don't need to use |
| | this line in your templates!* |
+------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| Records are injected | The default available marker for all records, when having lists is ``{records}`` |
| | (Can be configured in the Tonic Constants) |
+------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| A single record is injected | A single record when in single record context, can be called by using the default ``{record}`` |
| | (Can be configured in the Tonic Constants) |
+------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| A value for a field | To retrieve a value, use ``{record.fieldname}`` (e.g. ``{record.myfield}``. |
| | The values are of different return types. Please refer to your field configuration for more details. |
| | The frontend value is processed with the DataMapper. The frontend value is defined in the field |
| | setting ``Frontend Type Definition`` in the Tab ``Frontend Settings`` |
| | You can also use ``{record.fieldname}`` to get debug information |
+------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
.. note:: Of course you can use ``{_all}`` to find out which variables are available!
Predefining Templates
~~~~~~~~~~~~~~~~~~~~~
Templates in the selector can be predefined with the following TypoScript.
Please add the TypoScript to your root template.
.. code-block:: typoscript
plugin.tx_tonic.templates {
myTemplateIdentifier {
group = General
icon = EXT:tonic/Resources/Public/Icons/Datatype/brick.png
name = My Test Template
file = EXT:tonic_templates/Resources/Private/Templates/tonic_test1.html
}
}
.. image:: ../../Images/Screenshots/screenshot_template_selection.jpg
:width: 300px