From 4979c3f5c7114982a583c144e15127a8cb4d51a8 Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Thu, 14 Jul 2022 17:01:48 +0200 Subject: [PATCH 1/2] [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 --- .../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 26059a897b..038b4a34c0 100644 --- a/Documentation/ApiOverview/Fluid/Introduction.rst +++ b/Documentation/ApiOverview/Fluid/Introduction.rst @@ -174,9 +174,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 ====================================== From 1c890b6ccf21d312f444665b24e8248f86e15587 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Thu, 21 Jul 2022 11:33:49 +0200 Subject: [PATCH 2/2] Update Documentation/ApiOverview/Fluid/Introduction.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> --- Documentation/ApiOverview/Fluid/Introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ApiOverview/Fluid/Introduction.rst b/Documentation/ApiOverview/Fluid/Introduction.rst index 038b4a34c0..0cab4effd9 100644 --- a/Documentation/ApiOverview/Fluid/Introduction.rst +++ b/Documentation/ApiOverview/Fluid/Introduction.rst @@ -197,7 +197,7 @@ 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`.