Project

General

Profile

Actions

Task #65423

closed

Make condition-matching in TemplateService independent of global TSFE

Added by Stefan Neufeind about 9 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2015-02-28
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

To load the TypoScript for an arbitrary page in FE you can do something like:
$tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService');
$tmpl->start($rootLine);

Then $tmpl->setup will contain the TypoScript-setup for that page. But condition-matching (PIDinRootLine, ...) still works against the original page (using $GLOBALS['TSFE']) and not the page/rootline of our new TemplateService-instance.

Temporary workaround:
Overwrite parts of the global TSFE (of course backup them first) before calling $tmpl->start().
$GLOBALS['TSFE']->id = $returnPid;
$GLOBALS['TSFE']->tmpl->rootLine = $rootLine;

Actions

Also available in: Atom PDF