Skip to content

Commit

Permalink
[TASK] Refine PAGEVIEW descriptions (#1460)
Browse files Browse the repository at this point in the history
Remove experimental flag, use as example in the TypoScript Guide,
Always use the Resources/Private/PageView path to reduce confusion.

Hint at site package tutorial chapters

Releases: main, 13.4
  • Loading branch information
linawolf authored Dec 3, 2024
1 parent fe5503c commit 9d672c5
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 56 deletions.
8 changes: 4 additions & 4 deletions Documentation/ContentObjects/Fluidtemplate/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,11 @@ as :fluid:`{page.title}`, the subtitle with :fluid:`{page.subtitle}`.
In this example some Fluid templates have to be moved:

:path:`EXT:my_sitepackage/Resources/Private/Templates/Pages/`
The page templates can stay in this folder.
Move files to :path:`EXT:my_sitepackage/Resources/Private/PageView/Pages/`
:path:`EXT:my_sitepackage/Resources/Private/Partials/Pages/`
Move files to :path:`EXT:my_sitepackage/Resources/Private/Templates/Partials/`
Move files to :path:`EXT:my_sitepackage/Resources/Private/PageView/Partials/`
:path:`EXT:my_sitepackage/Resources/Private/Layouts/Pages/`
Move files to :path:`EXT:my_sitepackage/Resources/Private/Templates/Layouts/`
Move files to :path:`EXT:my_sitepackage/Resources/Private/PageView/Layouts/`

If the :path:`Private` folder previously looked like this:

Expand Down Expand Up @@ -458,7 +458,7 @@ It should look like this afterwards:
* :path:`EXT:my_sitepackage/Resources/Private/`

* :path:`Languages`
* :path:`Templates`
* :path:`PageView`

* :path:`Layouts`
* :path:`Pages`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ page {
10 = PAGEVIEW
10 {
paths {
100 = EXT:my_sitepackage/Resources/Private/Templates/
100 = EXT:my_sitepackage/Resources/Private/PageView/
}
variables {
parentPageTitle = TEXT
Expand All @@ -14,4 +14,4 @@ page {
10.as = mainMenu
}
}
}
}
70 changes: 37 additions & 33 deletions Documentation/ContentObjects/Pageview/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ PAGEVIEW
========

.. versionadded:: 13.1
The content object PAGEVIEW can be used in stead of
`FLUIDTEMPLATE <https://docs.typo3.org/permalink/t3tsref:cobj-template>`_
to configure the HTML body of a page using Fluid templates.

This API is considered experimental until TYPO3 v13 LTS. It will be further
adapted to be used for further rendering of
custom Content Elements and Content Blocks.
This content object has very specific conventions and
defaults, that requires (and allows) less configuration as compared to using
`FLUIDTEMPLATE <https://docs.typo3.org/permalink/t3tsref:cobj-template>`_.

The content object :typoscript:`EXTBASEPLUGIN` allows to render
:ref:`Extbase <t3coreapi:extbase>` plugins.

The new :typoscript:`PAGEVIEW` content object has very specific conventions and
defaults, that requires (and allows) less configuration. The benefit is that
following these conventions means less boilerplate code to maintain.
The benefit is that following these conventions means less boilerplate code
to maintain.

If you follow these conventions, a few directories and files must follow the
structure outlined below.

.. tip::
Chapters `The TYPO3 Fluid version <https://docs.typo3.org/permalink/t3sitepackage:minimal-extension-fluid>`_
and `Display the content elements on your page <https://docs.typo3.org/permalink/t3sitepackage:content-mapping>`_
of the Site Package Tutorial give practical examples on how to use
the `PAGEVIEW` object.

.. contents:: Table of contents
:local:
:depth: 2
Expand Down Expand Up @@ -74,7 +79,7 @@ Additional variables can be defined with property

The variable :fluid:`{settings}` contains all TypoScript
:ref:`constants <typoscript-syntax-constants>` that are set on the current
page. Settings from the site can be accessed via the :confval:`pageview-data-site` with
page. Settings from the site can be accessed via the :confval:`pageview-data-site` with
:fluid:`{site.settings}`

.. confval:: site
Expand All @@ -97,7 +102,7 @@ Example: Display the site title in the current language

.. literalinclude:: _includes/_DisplaySiteTitle.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Pages/Default.html

.. _cobj-pageview-data-page-example:

Expand All @@ -106,7 +111,7 @@ Example: Display the title and abstract of the current page

.. literalinclude:: _includes/_DisplayPageInfo.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Pages/Default.html

.. _cobj-pageview-data-settings-example:

Expand All @@ -121,7 +126,7 @@ Let us assume, the current page loads the following TypoScript constants:

.. literalinclude:: _includes/_PageWithConstant.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Pages/Default.html

.. _cobj-pageview-data-site-example:

Expand All @@ -130,7 +135,7 @@ Example: Link to the root page of the current site

.. literalinclude:: _includes/_LinkToRootPage.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Pages/Default.html

.. _cobj-pageview-properties:

Expand Down Expand Up @@ -169,8 +174,8 @@ Properties
:Example 2: :ref:`cobj-pageview-paths-example-extended`

Sets an array of paths for the Fluid templates, usually
:file:`EXT:my_extension/Resources/Private/Templates/` or a folder below that
path like :file:`EXT:my_extension/Resources/Private/Templates/MyPages`.
:file:`EXT:my_extension/Resources/Private/PageView/` or a
path like :file:`EXT:my_extension/Resources/Private/PageView/MyPage`.

The templates are expected in a subfolder :path:`Pages`.

Expand Down Expand Up @@ -207,20 +212,20 @@ The page template could look like this:

.. literalinclude:: _includes/_PageWithBreadcrumb.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Pages/Default.html


With the following partials:

.. literalinclude:: _includes/_PartialBreadCrumb.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Partials/Navigation/Breadcrumb.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Partials/Navigation/Breadcrumb.html

And

.. literalinclude:: _includes/_PartialMainNavigation.html
:language: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Partials/Navigation/MainNavigation.html
:caption: EXT:my_sitepackage/Resources/Private/PageView/Partials/Navigation/MainNavigation.html

.. _cobj-pageview-paths-example:

Expand All @@ -235,14 +240,14 @@ templates:
page = PAGE
page.10 = PAGEVIEW
page.10.paths.100 = EXT:my_sitepackage/Resources/Private/Templates/
page.10.paths.100 = EXT:my_sitepackage/Resources/Private/PageView/
The content of the folder could look like this:

.. directory-tree::
:level: 2

* EXT:my_sitepackage/Resources/Private/Templates/
* EXT:my_sitepackage/Resources/Private/PageView/

* Layouts

Expand Down Expand Up @@ -270,17 +275,17 @@ The content of the folder could look like this:

So for backend layout named "with_sidebar", the template file is
then resolved to
:file:`EXT:my_sitepackage/Resources/Private/Templates/Pages/With_sidebar.html`.
:file:`EXT:my_sitepackage/Resources/Private/PageView/Pages/With_sidebar.html`.

If the backend layout is named "TwoColumns" it is resovled to
:file:`EXT:my_sitepackage/Resources/Private/Templates/Pages/TwoColumns.html`.
:file:`EXT:my_sitepackage/Resources/Private/PageView/Pages/TwoColumns.html`.

For all these templates
:doc:`partial <t3viewhelper:Global/Render#viewhelper-argument-typo3-cms-fluid-viewhelpers-renderviewhelper-partial>`
are expected in folder
:path:`EXT:my_sitepackage/Resources/Private/Templates/Pages/Partials` and
:path:`EXT:my_sitepackage/Resources/Private/PageView/Pages/Partials` and
:ref:`layouts <t3viewhelper:typo3fluid-fluid-layout>` in
:path:`EXT:my_sitepackage/Resources/Private/Templates/Pages/Layouts`.
:path:`EXT:my_sitepackage/Resources/Private/PageView/Pages/Layouts`.

.. _cobj-pageview-paths-example-extended:

Expand All @@ -296,16 +301,16 @@ define fallback directories for the templates:
page {
10 = PAGEVIEW
10.paths {
100 = EXT:my_basic_sitepackage/Resources/Private/Templates/
200 = EXT:my_general_sitepackage/Resources/Private/Templates/
300 = EXT:my_special_sitepackage/Resources/Private/Templates/
100 = EXT:my_basic_sitepackage/Resources/Private/PageView/
200 = EXT:my_general_sitepackage/Resources/Private/PageView/
300 = EXT:my_special_sitepackage/Resources/Private/PageView/
}
}
The template for a page with a certain backend layout is first searched in
:path:`EXT:my_special_sitepackage/Resources/Private/Templates/Pages/` then in
:path:`EXT:my_general_sitepackage/Resources/Private/Templates/Pages/` and last
in :path:`EXT:my_basic_sitepackage/Resources/Private/Templates/Pages/`.
:path:`EXT:my_special_sitepackage/Resources/Private/PageView/Pages/` then in
:path:`EXT:my_general_sitepackage/Resources/Private/PageView/Pages/` and last
in :path:`EXT:my_basic_sitepackage/Resources/Private/PageView/Pages/`.

.. _cobj-pageview-variables-example:

Expand All @@ -320,5 +325,4 @@ The following variables are now available in the Fluid template:

.. literalinclude:: _includes/_PageWithVariables.html
:langugage: html
:caption: EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html

:caption: EXT:my_sitepackage/Resources/Private/PageView/Pages/Default.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ page {
10 = PAGEVIEW
10 {
paths {
100 = EXT:my_sitepackage/Resources/Private/Templates/
100 = EXT:my_sitepackage/Resources/Private/PageView/
}
dataProcessing {
10 = menu
Expand All @@ -21,4 +21,4 @@ page {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ page {
10 = PAGEVIEW
10 {
paths {
100 = EXT:my_sitepackage/Resources/Private/Templates/
100 = EXT:my_sitepackage/Resources/Private/PageView/
}
variables {
parentPageTitle = TEXT
parentPageTitle.data = levelfield:-1:title
}
dataProcessing {
10 = menu
10.as = mainMenu
10 = page-content
20 = menu
20.as = mainMenu
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ page {
10 = PAGEVIEW
10 {
paths {
100 = EXT:my_sitepackage/Resources/Private/Templates/
100 = EXT:my_sitepackage/Resources/Private/PageView/
}
variables {
parentPageTitle = TEXT
parentPageTitle.data = levelfield:-1:title
another_variable =< lib.anotherVariable
}
}
}
}
5 changes: 2 additions & 3 deletions Documentation/Guide/Menu/_menu.typoscript
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
page = PAGE
page {
10 = FLUIDTEMPLATE
10 = PAGEVIEW
10 {
templateName = Default
templateRootPaths.10 = EXT:site_package/Resources/Private/Templates/Pages/
paths.10 = EXT:my_site_package/Resources/Private/Templates/Pages/
# ...
dataProcessing {
10 = menu
Expand Down
12 changes: 6 additions & 6 deletions Documentation/Guide/Page/_fluid-template.typoscript
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
page = 10
page {
10 = FLUIDTEMPLATE
10 = PAGEVIEW
10 {
templateName = TEXT
templateName.value = Default

templateRootPaths {
0 = EXT:site_package/Resources/Private/Templates/Pages/
paths {
100 = EXT:my_site_package/Resources/Private/PageView/
}
dataProcessing {
10 = page-content
}
}
}

0 comments on commit 9d672c5

Please sign in to comment.