From 65bae29c8b95df757d057909873a560d6a858d3f Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Thu, 21 Jul 2022 18:33:29 +0200 Subject: [PATCH] [TASK] Expand section about partials (#1978) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [TASK] Expand section about partials Since this part, should replace the page "Moving repeating snippets to partials" in the Extbase book, it should include an example. Related: TYPO3-Documentation/TYPO3CMS-Book-ExtbaseFluid#536 * Update Documentation/ApiOverview/Fluid/Introduction.rst Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> Co-authored-by: Lina Wolf <48202465+linawolf@users.noreply.github.com> Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> --- .../ApiOverview/Fluid/Introduction.rst | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Documentation/ApiOverview/Fluid/Introduction.rst b/Documentation/ApiOverview/Fluid/Introduction.rst index 6555ea8465..006d6549b7 100644 --- a/Documentation/ApiOverview/Fluid/Introduction.rst +++ b/Documentation/ApiOverview/Fluid/Introduction.rst @@ -182,9 +182,35 @@ The template should include the sections which are to be rendered. *optional* -Partials are a Fluid component. Partials can be used as reusable components from within -a template. +Some parts within different templates might be the same. To not repeat this part +in multiple templates, Fluid offers so-called partials. Partials are small pieces +of Fluid template within a separate file that can be included in multiple templates. +Partials are stored, by convention, within :file:`Resources/Private/Partials/`. + +Example partial: + +.. code-block:: html + :caption: EXT:my_extension/Resources/Private/Partials/Tags.html + + Tags: + + +Example template using the partial: + +.. code-block:: html + :caption: EXT:my_extension/Resources/Private/Templates/Show.html + + + +The variable :html:`post.tags` is passed to the partial as variable :html:`tags`. + +If ViewHelpers from a different namespace are used in the partial, the namespace +import can be done in the template or the partial. Example: Using Fluid to create a theme ======================================