Feature: #103504 - New ContentObject PAGEVIEW¶
See forge#103504
Description¶
A new content object for TypoScript PAGEVIEW
has been added.
This cObject is mainly intended for rendering a full page in the TYPO3 frontend
with fewer configuration options over the generic FLUIDTEMPLATE
cObject.
A basic usage of the PAGEVIEW
cObject is as follows:
page = PAGE
page.10 = PAGEVIEW
page.10.paths.100 = EXT:mysite/Resources/Private/Templates/
PAGEVIEW
wires certain parts automatically:
-
The name of the used page layout (backend layout) is resolved automatically.
If a page has a layout named "with_sidebar", the template file is then resolved to
EXT:mysite/Resources/Private/Templates/Pages/With_sidebar.html
. -
Fluid features for layouts and partials are wired automatically, thus they can be placed into
EXT:mysite/Resources/Private/Templates/Layouts/
andEXT:mysite/Resources/Private/Templates/Partials/
.In order to reduce the burden for integrators, the folder names for "pages", "layouts" and "partials" can start with a lowercase or an uppercase letter.
-
Default variables are available in the Fluid template:
settings
- contains all TypoScript settings (= constants)site
- the currentSite
objectlanguage
- the currentSiteLanguage
objectpage
- the current page record as object
Note
The PageInformation
object contains all relevant information about
the current page. Those are, for example, the corresponding page record, the
root line, and many more. Worth mentioning is also the PageLayout
object, which provides all the information about the selected backend layout.
This includes the identifier, the title, the available content areas
with their corresponding name and colPos
. Additionally, the full (raw)
backend layout configuration is available.
There is no special Extbase resolving done for the templates.
Migration¶
Before¶
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName {
stdWrap {
cObject = TEXT
cObject {
data = levelfield:-2, backend_layout_next_level, slide
override {
field = backend_layout
}
split {
token = pagets__
1 {
current = 1
wrap = |
}
}
}
ifEmpty = Standard
}
}
templateRootPaths {
100 = {$plugin.tx_mysite.paths.templates}
}
partialRootPaths {
100 = {$plugin.tx_mysite.paths.partials}
}
layoutRootPaths {
100 = {$plugin.tx_mysite.paths.layouts}
}
variables {
pageUid = TEXT
pageUid.data = page:uid
pageTitle = TEXT
pageTitle.data = page:title
pageSubtitle = TEXT
pageSubtitle.data = page:subtitle
parentPageTitle = TEXT
parentPageTitle.data = levelfield:-1:title
}
dataProcessing {
10 = menu
10.as = mainMenu
}
}
}
After¶
page = PAGE
page {
10 = PAGEVIEW
10 {
paths {
100 = {$plugin.tx_mysite.paths.templates}
}
variables {
parentPageTitle = TEXT
parentPageTitle.data = levelfield:-1:title
}
dataProcessing {
10 = menu
10.as = mainMenu
}
}
}
In Fluid, the pageUid is available as {page.uid}
and pageTitle
as {page.title}
. The page layout identifier can be accessed
using {page.pageLayout.identifier}
.
Impact¶
Creating new page templates based on Fluid follows conventions in order to reduce the amount of TypoScript needed to render a page in the TYPO3 frontend.
Sane defaults are applied, variables and settings are available at any time.
Note
This cObject is marked as experimental until TYPO3 v13 LTS as some functionality will be added.
Note
Default variable names cannot be set or overridden and trying to do will throw an exception.