Skip to content

Commit ed2e294

Browse files
[DOCS] Overhaul fluid templates (#366)
* [DOCS] Overhaul fluid templates Releases: main, Backport: 13.4 * Fix capitalization of 'Fluid' in Index.rst Correct capitalization of 'Fluid' in multiple instances throughout the document. * Apply suggestion from @linawolf --------- Co-authored-by: Lina Wolf <[email protected]>
1 parent 9059449 commit ed2e294

File tree

2 files changed

+64
-66
lines changed

2 files changed

+64
-66
lines changed

Documentation/FluidTemplates/FromTheScratch.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
.. _fluid-templates-scratch:
55

6-
================================
7-
Fluid Templates from the Scratch
8-
================================
6+
============================
7+
Fluid Templates from Scratch
8+
============================
99

1010

1111
.. contents::

Documentation/FluidTemplates/Index.rst

Lines changed: 61 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
Fluid Templates
88
===============
99

10-
To understand the following section you need basic knowledge about how to use the
10+
To understand the following section you need basic knowledge of the
1111
:ref:`Fluid templating engine <t3start:fluid-templates>` and
1212
:ref:`TypoScript <t3start:typoscript>`.
1313

14-
This chapter is based on the following steps:
14+
This chapter assumes the following:
1515

1616
* A Composer-based TYPO3 installation, at least version 13.4.
1717
* You have installed a
1818
`Generate a site package of type "Site Package Tutorial" <https://docs.typo3.org/permalink/t3sitepackage:minimal-design>`_,
1919
including the example page tree loaded in `Create initial pages <https://docs.typo3.org/permalink/t3sitepackage:typo3-backend-create-initial-pages>`_.
20-
* You have familiarized yourself with `Asset handling in TYPO3 <https://docs.typo3.org/permalink/t3sitepackage:assets-theme>`_
21-
(CSS, JavaScript, design related images, ...)
20+
* You are familiar with `Asset handling in TYPO3 <https://docs.typo3.org/permalink/t3sitepackage:assets-theme>`_
21+
(CSS, JavaScript, design related images, etc)
2222

23-
After this tutorial you have a better understanding of the example templates and
24-
how to adjust them to your needs. You should also be able to create some
25-
templates yourself.
23+
After this tutorial you will have a better understanding of Fluid templates and
24+
how to customize them to your needs. You should also be able to create some
25+
Fluid templates yourself.
2626

27-
If you prefer to start with a pure HTML template and build all templates
28-
step by step, you can alternatively have a look a :ref:`fluid-templates-scratch`.
27+
If you prefer to start with an HTML template and build it up to a Fluid template
28+
step by step, have a look at :ref:`fluid-templates-scratch`.
2929

3030
.. contents:: Topics covered in this chapter
3131

@@ -40,22 +40,22 @@ step by step, you can alternatively have a look a :ref:`fluid-templates-scratch`
4040
The page view
4141
=============
4242

43-
The Fluid templates for the whole page have to be configured via TypoScript.
43+
The Fluid templates that we will use to output the frontend pages have to be configured via TypoScript.
4444

45-
In the example site package that was `Generated for you <https://docs.typo3.org/permalink/t3sitepackage:minimal-design>`_
46-
the according TypoScript can be found in file
45+
In the site package that was `Generated for you <https://docs.typo3.org/permalink/t3sitepackage:minimal-design>`_,
46+
the TypoScript configuration can be found in
4747
:file:`packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/page.typoscript`:
4848

4949
.. literalinclude:: /CodeSnippets/my_site_package/Configuration/Sets/SitePackage/TypoScript/page.typoscript
5050
:caption: packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/page.typoscript
5151
:linenos:
5252
:emphasize-lines: 3,6
5353

54-
Line 3 defines that Fluid templates should be used for the page by using the
55-
TypoScript object `PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_.
54+
Line 3 defines that Fluid templates should be configured using the
55+
`PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_ TypoScript object .
5656

57-
In line 6 the default path to the page view templates is defined. The definition
58-
could be extended in line 7 by a setting later own. For now assume all Fluid
57+
Line 6 defines the default path to the page view templates. We can add further
58+
paths to the definition in line 7 with a site setting later on. For now assume all Fluid
5959
templates for the page can be found in folder
6060
:path:`packages/my_site_package/Resources/Private/PageView`.
6161

@@ -65,78 +65,76 @@ The default page template
6565
=========================
6666

6767
Unless a different page layout is chosen, `PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_
68-
expects the main template of the page in file :file:`PageView/Pages/Default.html` within
69-
the defined folder (:path:`packages/my_site_package/Resources/Private/PageView`).
68+
expects the main template of the page to be :file:`PageView/Pages/Default.html` in
69+
the folder :path:`packages/my_site_package/Resources/Private/PageView` (the path
70+
that we defined above).
7071

71-
Let us have a look at this template now:
72+
Let's have a look at this default page template:
7273

7374
.. literalinclude:: /CodeSnippets/my_site_package/Resources/Private/PageView/Pages/Default.html
7475
:caption: packages/my_site_package/Resources/Private/PageView/Pages/Default.html
7576
:linenos:
7677
:emphasize-lines: 1,2,4
7778

7879
* In line 1 the `Layout ViewHelper <f:layout> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-layout>`_
79-
is defined to load a layout template from folder :path:`PageView/Layouts`. The file
80-
must have the same name of the templated, followed by `.html`, therefore
81-
file :file:`packages/my_site_package/Resources/Private/PageView/Layouts/PageLayout.html`
82-
is loaded as layout.
83-
* Line 2 starts a new section with name "Main", using the
80+
loads a layout template from the :path:`PageView/Layouts` folder. The layout
81+
file is referred to by name, with an `.html` on the end. The layout file here is
82+
:file:`packages/my_site_package/Resources/Private/PageView/Layouts/PageLayout.html`.
83+
* Line 2 starts a section called "Main", using the
8484
`Section ViewHelper <f:section> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-section>`_.
85-
* In Line 4 and 7 partial templates are loaded from :path:`Partials`. They follow
86-
the same naming scheme like the Layout and are therefore located in
87-
files :file:`Documentation/CodeSnippets/my_site_package/Resources/Private/PageView/Partials/Content.html`
88-
and :file:`Documentation/CodeSnippets/my_site_package/Resources/Private/PageView/Partials/Stage.html`.
89-
To do this they use the `Render ViewHelper <f:render> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render>`_.
85+
* Lines 4 and 7 load partial templates from the :path:`Partials` folder. They follow
86+
the same naming scheme as the layout: they are located in
87+
:file:`packages/my_site_package/Resources/Private/PageView/Partials/Content.html`
88+
and :file:`packages/my_site_package/Resources/Private/PageView/Partials/Stage.html`.
89+
The partials are loaded with the `Render ViewHelper <f:render> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render>`_.
9090

9191
.. _layout-template:
9292

9393
The Fluid layout template
9494
=========================
9595

96-
The outer most HTML that is needed for all different page layouts is usually
97-
defined in a layout template:
96+
The outermost HTML on a page/pages is defined by a layout template:
9897

9998
.. literalinclude:: /CodeSnippets/my_site_package/Resources/Private/PageView/Layouts/PageLayout.html
10099
:caption: /CodeSnippets/my_site_package/Resources/Private/PageView/Layouts/PageLayout.html
101100
:linenos:
102101
:emphasize-lines: 5
103102

104-
The layout template takes care of loading assets like CSS and JavaScript that
105-
are needed on all pages, using the `Asset collector <https://docs.typo3.org/permalink/t3coreapi:asset-collector>`_.
103+
The layout template takes care of loading assets that
104+
are needed on all pages, like CSS and JavaScript. It uses the `Asset collector <https://docs.typo3.org/permalink/t3coreapi:asset-collector>`_.
106105

107-
To configure the asset collector, the `Asset.css ViewHelper <f:asset.css> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-asset-css>`_
108-
and `Asset.script ViewHelper <f:asset.script> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-asset-script>`_
109-
are used.
106+
The asset collector is configured using the `Asset.css ViewHelper <f:asset.css> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-asset-css>`_
107+
and `Asset.script ViewHelper <f:asset.script> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-asset-script>`_.
110108

111-
The layout also renders sections that need to be defined with the
112-
`Section ViewHelper <f:section> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-section>`_
113-
in the page template. In line 5 the section is rendered, which is defined in line
114-
2-10 of the "Default" page template. It is possible to define several sections
115-
and to define optional sections. We do not demonstrate that here.
109+
Also, the layout template renders sections using a
110+
`Section ViewHelper <f:section> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-section>`_.
111+
The sections are defined in the page template. The "Main" section in line 5
112+
is defined in lines 2-10 of the "Default" page template. It is possible to define
113+
optional sections (not shown here).
116114

117-
The layout template also loads some more partials, for example to display
115+
Our layout template also loads some partials, for example, to display the
118116
menu and the footer.
119117

120118
.. _page-html-structure:
121119

122-
Outer most HTML structure (body, head)
123-
======================================
120+
Outermost HTML structure (body, head)
121+
=====================================
124122

125-
The outer most HTML structure is usually not handled by your custom templates. It
126-
can be configured via the TypoScript configuration of the
123+
The outermost HTML is not usually handled in Fluid templates. It
124+
is configured via TypoScript configuration of the
127125
`PAGE <https://docs.typo3.org/permalink/t3tsref:object-type-page>`_ object.
128126

129-
For example you can use option :ref:`shortcutIcon <t3tsref:confval-page-shortcuticon>`
130-
to load a favicon, :ref:`meta <t3tsref:confval-page-meta>` to define meta tags,
131-
or add tags to the body tag using :ref:`bodyTagAdd <t3tsref:confval-page-bodytagadd>`.
127+
For example, you can use the :ref:`shortcutIcon <t3tsref:confval-page-shortcuticon>`
128+
option to load a favicon, :ref:`meta <t3tsref:confval-page-meta>` to define meta tags,
129+
and :ref:`bodyTagAdd <t3tsref:confval-page-bodytagadd>` to add tags to the body tag.
132130

133-
The page object, including examples is described in detail in the TypoScript
134-
reference, chapter `Configure the PAGE in TypoScript <https://docs.typo3.org/permalink/t3tsref:guide-page>`_.
131+
The page object, including examples, is described in detail in the TypoScript
132+
reference. See `Configure the PAGE in TypoScript <https://docs.typo3.org/permalink/t3tsref:guide-page>`_.
135133

136134
.. _partial-template:
137135

138-
The footer: Example for a partial template
139-
==========================================
136+
The footer: Example of a partial template
137+
=========================================
140138

141139
In the :ref:`layout template <layout-template>` the following partial was loaded:
142140

@@ -145,22 +143,22 @@ In the :ref:`layout template <layout-template>` the following partial was loaded
145143
:linenos:
146144
:emphasize-lines: 5-7,11
147145

148-
Line 5 uses the `Link.page ViewHelper <f:link.page> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-link-page>`_
149-
to link to the start page, which is the same like the root page and found in the
150-
variable `{site.rootPageId}`.
146+
Line 5 uses a `Link.page ViewHelper <f:link.page> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-link-page>`_
147+
to link to the start page. The start page is the same as the root page and is found in the
148+
`{site.rootPageId}` variable.
151149

152150
The variable `{site}` is automatically provided by the
153-
`PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_. All
154-
available variables are described in the TypoScript Reference, section
151+
`PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_ TypoScript object. All
152+
variables are described in the TypoScript Reference. See
155153
`Default variables in Fluid templates <https://docs.typo3.org/permalink/t3tsref:cobj-pageview-data>`_.
156154

157-
Line 6 uses the `Image ViewHelper <f:image> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-image>`_
155+
Line 6 uses an `Image ViewHelper <f:image> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-image>`_
158156
to display a logo in the footer. The path to the logo and its alt tag are
159-
defined in the settings definition. More about this in chapter
160-
`Setting definition <https://docs.typo3.org/permalink/t3sitepackage:settings-definitions-yaml-constants>`_.
157+
defined in the site package settings definitions. See
158+
`Setting definitions <https://docs.typo3.org/permalink/t3sitepackage:settings-definitions-yaml-constants>`_.
161159

162-
In line 11 yet another partial is included. This partial displays a menu in the
163-
footer. More about this topic in chapter :ref:`Configure the menus <main-menu-creation>`.
160+
Line 11 adds another partial. This partial displays a menu in the
161+
footer. See :ref:`Configuring the menus <main-menu-creation>`.
164162

165163
.. _fluid-templates-next-steps:
166164

0 commit comments

Comments
 (0)