TypoScriptFrontendController
Main controller class of the TypoScript based frontend.
since TYPO3 v13, will vanish during v14 development. There are some remaining internal usages that can be adapted without further .rst files.
This is prepared in Frontend middlewares and the content rendering is ultimately called in \TYPO3\CMS\Frontend\Http\RequestHandler.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Methods
- __construct() : mixed
- applyHttpHeadersToResponse() : ResponseInterface
- Add HTTP headers to the response object.
- generatePage_postProcessing() : string
- Does processing of the content after the page content was generated.
- generatePageTitle() : string
- Generate the page title, can be called multiple times, as PageTitleProvider might have been modified by an uncached plugin etc.
- INTincScript() : string
- Processes the INTinclude-scripts
- isStaticCacheble() : bool
- Reporting status whether we can send cache control headers for proxy caching or publishing to static files
- get_cache_timeout() : int
- Get the cache timeout for the current page.
- getAdditionalHeaders() : array<string|int, mixed>
- Send additional headers from config.additionalHeaders
- getBackendUser() : FrontendBackendUserAuthentication|null
- getCacheHeaders() : array<string|int, mixed>
- Get cache headers good for client/reverse proxy caching.
- getTimeTracker() : TimeTracker
- getWebsiteTitle() : string
- printTitle() : string
- Compiles the content for the page <title> tag.
- processNonCacheableContentPartsAndSubstituteContentMarkers() : string
- Processes the INTinclude-scripts and substitute in content.
- recursivelyReplaceIntPlaceholdersInContent() : string
- Replace INT placeholders (COA_INT and USER_INT) in content. In case the replacement adds additional placeholders, it loops until no new placeholders are found anymore.
- setAbsRefPrefixInContent() : string
- Converts relative paths in the HTML source to absolute paths for fileadmin/, typo3conf/ext/ and media/ folders.
- setPageCacheContent() : void
- Sets cache content; Inserts the content string into the pages cache.
- setSysLastChanged() : void
- Setting the SYS_LASTCHANGED value in the pagerecord: This value will thus be set to the highest tstamp of records rendered on the page.
Methods
__construct()
public
__construct(Context $context, FrontendInterface $pageCache) : mixed
Parameters
- $context : Context
- $pageCache : FrontendInterface
applyHttpHeadersToResponse()
Add HTTP headers to the response object.
public
applyHttpHeadersToResponse(ServerRequestInterface $request, ResponseInterface $response, string $content) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $content : string
Return values
ResponseInterfacegeneratePage_postProcessing()
Does processing of the content after the page content was generated.
public
generatePage_postProcessing(ServerRequestInterface $request, string $content) : string
This includes caching the page, indexing the page (if configured) and setting sysLastChanged
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
stringgeneratePageTitle()
Generate the page title, can be called multiple times, as PageTitleProvider might have been modified by an uncached plugin etc.
public
generatePageTitle(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Return values
stringINTincScript()
Processes the INTinclude-scripts
public
INTincScript(ServerRequestInterface $request, string $content) : string
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
stringisStaticCacheble()
Reporting status whether we can send cache control headers for proxy caching or publishing to static files
public
isStaticCacheble(ServerRequestInterface $request) : bool
Rules are: no_cache cannot be set: If it is, the page might contain dynamic content and should never be cached. There can be no USER_INT objects on the page because they implicitly indicate dynamic content There can be no logged-in user because user sessions are based on a cookie and thereby does not offer client caching a chance to know if the user is logged in. Actually, there will be a reverse problem here; If a page will somehow change when a user is logged in he may not see it correctly if the non-login version sent a cache-header! So do NOT use cache headers in page sections where user logins change the page content. (unless using such as realurl to apply a prefix in case of login sections)
Parameters
- $request : ServerRequestInterface
Return values
boolget_cache_timeout()
Get the cache timeout for the current page.
protected
get_cache_timeout(ServerRequestInterface $request) : int
Parameters
- $request : ServerRequestInterface
Return values
intgetAdditionalHeaders()
Send additional headers from config.additionalHeaders
protected
getAdditionalHeaders(ServerRequestInterface $request) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
Return values
array<string|int, mixed>getBackendUser()
protected
getBackendUser() : FrontendBackendUserAuthentication|null
Return values
FrontendBackendUserAuthentication|nullgetCacheHeaders()
Get cache headers good for client/reverse proxy caching.
protected
getCacheHeaders(ServerRequestInterface $request, string $content) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
array<string|int, mixed>getTimeTracker()
protected
getTimeTracker() : TimeTracker
Return values
TimeTrackergetWebsiteTitle()
protected
getWebsiteTitle(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Return values
stringprintTitle()
Compiles the content for the page <title> tag.
protected
printTitle(ServerRequestInterface $request, string $pageTitle[, bool $noPageTitle = false ][, bool $showPageTitleFirst = false ][, string $pageTitleSeparator = '' ][, bool $showWebsiteTitle = true ]) : string
Parameters
- $request : ServerRequestInterface
- $pageTitle : string
-
The input title string, typically the "title" field of a page's record.
- $noPageTitle : bool = false
-
If set, the page title will not be printed
- $showPageTitleFirst : bool = false
-
If set, website title and page title are swapped
- $pageTitleSeparator : string = ''
-
an alternative to the ": " as the separator between site title and page title
- $showWebsiteTitle : bool = true
-
If set, the website title will be printed
Tags
Return values
string —The page title on the form "[website title]: [input-title]". Not htmlspecialchar()'ed.
processNonCacheableContentPartsAndSubstituteContentMarkers()
Processes the INTinclude-scripts and substitute in content.
protected
processNonCacheableContentPartsAndSubstituteContentMarkers(array<string|int, mixed> $nonCacheableData, ServerRequestInterface $request, string $incomingContent) : string
Takes content and splits it content by and then puts the content back together.
Parameters
- $nonCacheableData : array<string|int, mixed>
- $request : ServerRequestInterface
- $incomingContent : string
Return values
stringrecursivelyReplaceIntPlaceholdersInContent()
Replace INT placeholders (COA_INT and USER_INT) in content. In case the replacement adds additional placeholders, it loops until no new placeholders are found anymore.
protected
recursivelyReplaceIntPlaceholdersInContent(ServerRequestInterface $request, string $content) : string
Parameters
- $request : ServerRequestInterface
- $content : string
Return values
stringsetAbsRefPrefixInContent()
Converts relative paths in the HTML source to absolute paths for fileadmin/, typo3conf/ext/ and media/ folders.
protected
setAbsRefPrefixInContent(string $content, string $absRefPrefix) : string
Parameters
- $content : string
- $absRefPrefix : string
Return values
stringsetPageCacheContent()
Sets cache content; Inserts the content string into the pages cache.
protected
setPageCacheContent(ServerRequestInterface $request, string $content, array<string|int, mixed> $INTincScript, array<string|int, mixed> $pageTitleCache[, array<string|int, mixed> $metaDataState = [] ]) : void
Parameters
- $request : ServerRequestInterface
- $content : string
-
The content to store in the HTML field of the cache table
- $INTincScript : array<string|int, mixed>
- $pageTitleCache : array<string|int, mixed>
- $metaDataState : array<string|int, mixed> = []
Tags
setSysLastChanged()
Setting the SYS_LASTCHANGED value in the pagerecord: This value will thus be set to the highest tstamp of records rendered on the page.
protected
setSysLastChanged(ServerRequestInterface $request) : void
This includes all records with no regard to hidden records, userprotection and so on.
The important part is that this actually updates a translated "pages" record (_LOCALIZED_UID) if the Frontend is called with a translation.
Parameters
- $request : ServerRequestInterface