Skip to content

Commit 4f42d5b

Browse files
linawolffroemken
andauthored
[TASK] Display page and config on top level of Frontend TypoScript (#1525)
* [BUGFIX] Display page and config on top level of Frontend TypoScript The page is the starting point for whatever rendering is configured via TypoScript. It is hard to find within the "Top level object." The TypoScript config also has a central and special handling. Leave hints of how they can be found in the previous place in the Top Level objects Releases: main, 13.4 * Apply suggestions from code review * Update Documentation/TopLevelObjects/PageAndConfig.rst Co-authored-by: Stefan Frömken <froemken@gmail.com> --------- Co-authored-by: Stefan Frömken <froemken@gmail.com>
1 parent 245428c commit 4f42d5b

File tree

5 files changed

+76
-34
lines changed

5 files changed

+76
-34
lines changed

Documentation/Index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ chapter.
5252
:maxdepth: 1
5353
:titlesonly:
5454

55+
TopLevelObjects/Page/Index
5556
ContentObjects/Index
5657
DataProcessing/Index
58+
TopLevelObjects/Config
5759
TopLevelObjects/Index
5860
Functions/Index
5961
Conditions/Index

Documentation/TopLevelObjects/Config.rst

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:navigation-title: Config
2+
13
.. include:: /Includes.rst.txt
24
.. index::
35
config
@@ -7,38 +9,23 @@
79
.. _config-datatype:
810
.. _top-level-objects-config:
911

10-
===============
11-
CONFIG & config
12-
===============
13-
14-
.. contents:: Table of content
15-
:depth: 1
16-
17-
.. _top-level-objects-config-about:
18-
19-
The 'config' top-level-object
20-
=============================
12+
==================================
13+
`config`: TypoScript configuration
14+
==================================
2115

22-
Internally TYPO3 always creates an array `config` with various configuration
23-
values which are evaluated during the rendering process and treated in some
24-
special, predefined and predictive way. This is what we mean when we say the
25-
property `config`, actually the array `'config'` is of type CONFIG. It is a
26-
"top-level-object" because it is not subordinate to any other configuration
27-
setting.
28-
29-
In PHP you can refer to the array within :file:`typo3/sysext/frontend/Classes/`
30-
files by writing :php:`$GLOBALS['TSFE']->config['config']`.
31-
32-
This typoscript "top level object" `config` provides access to the internal
33-
array. This means, that configuration settings can be made easily. For example:
16+
The `config` top-level object does not have to be initialized, configuration
17+
settings can be made like this:
3418

3519
.. code-block::
20+
:caption: config/sites/my_site/setup.typoscript
3621
3722
# TypoScript
38-
config.debug = 1
23+
config {
24+
headerComment = Made with ❤ by your TYPO3 Documentation Team
25+
}
3926
40-
# will produce, in php
41-
$GLOBALS['TSFE']->config['config']['debug'] // with value 1
27+
.. contents:: Table of content
28+
:depth: 1
4229

4330
.. _setup-config-xmlprologue:
4431
.. _setup-config-typolinklinkaccessrestrictedpages-ATagParams:

Documentation/TopLevelObjects/Index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ config :ref:`CONFIG <config-datatype>`
3434
:ref:`sitetitle <tlo-sitetitle>` readonly
3535
===================================== =========================
3636

37-
3837
.. toctree::
3938
:hidden:
4039

41-
Config
40+
PageAndConfig
4241
Module
43-
Page/Index
4442
Plugin
4543
Other

Documentation/TopLevelObjects/Page/Index.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
:navigation-title: Page
2+
13
.. include:: /Includes.rst.txt
24
.. index::
3-
PAGE
4-
Top-level objects; page
5+
PAGE
6+
Top-level objects; page
57
.. _page:
68
.. _page-datatype:
79
.. _object-type-page:
810

9-
====
10-
PAGE
11-
====
11+
12+
================================
13+
`PAGE` object type in TypoScript
14+
================================
1215

1316
This defines what is rendered in the frontend.
1417

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
:navigation-title: page & config
2+
3+
.. include:: /Includes.rst.txt
4+
.. _page-config:
5+
6+
===============================================
7+
`page` and `config` on the TypoScript top level
8+
===============================================
9+
10+
By convention the main rendering of a page (page type 0) is configured in a top
11+
level object called `page`. It is of type
12+
`PAGE <https://docs.typo3.org/permalink/t3tsref:object-type-page>`_.
13+
14+
The main TypoScript configuration is always done in a top level object called
15+
`config`. It is of type
16+
`CONFIG <https://docs.typo3.org/permalink/t3tsref:top-level-objects-config>`_.
17+
18+
.. contents:: Table of Contents
19+
20+
.. _top-level-objects-page:
21+
22+
The 'page' top-level-object
23+
=============================
24+
25+
The `page` object should be of type `PAGE <https://docs.typo3.org/permalink/t3tsref:object-type-page>`_
26+
with property :ref:`typeNum <t3tsref:confval-page-typenum>` (also called page type)
27+
set to `0`, which is the default.
28+
29+
Some site package authors decide to give the main `PAGE <https://docs.typo3.org/permalink/t3tsref:object-type-page>`_
30+
object a different top level name like `mypage`, however this can be confusing
31+
to subsequent integrators and not compatible with extensions that also make
32+
settings to the `page` top level object.
33+
34+
TYPO3 does not initialize :typoscript:`page` by default. You must initialize this
35+
explicitly, for example:
36+
37+
.. code-block:: typoscript
38+
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
39+
40+
page = PAGE
41+
42+
.. _top-level-objects-config-about:
43+
44+
The 'config' top-level-object
45+
=============================
46+
47+
Internally TYPO3 always creates an array `config` with various configuration
48+
values which are evaluated during the rendering process and treated in some
49+
special, predefined and predictive way. This is what we mean when we say the
50+
property `config`, actually the array `'config'` is of type CONFIG. It is a
51+
"top-level-object" because it is not subordinate to any other configuration
52+
setting.

0 commit comments

Comments
 (0)