public function initializeForTYPO3VLowerThan10(int $pageUid)
{
$GLOBALS['TT'] = new TimeTracker();
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$templateService = GeneralUtility::makeInstance(TemplateService::class);
// get the rootline
$rootLine = $pageRepository->getRootLine($pageUid);
// initialize template service and generate typoscript configuration
$templateService->init();
$templateService->runThroughTemplates($rootLine);
$templateService->generateConfig();
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($templateService, __FILE__ . ':' . __LINE__);
}
public function initializeForTYPO3V10(int $pageUid)
{
$rootlineUtil = GeneralUtility::makeInstance(RootlineUtility::class, [$pageUid]);
$templateService = GeneralUtility::makeInstance(TemplateService::class);
// get the rootline
$rootLine = $rootlineUtil->get();
// initialize template service and generate typoscript configuration
$templateService->runThroughTemplates($rootLine);
$templateService->generateConfig();
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($templateService, __FILE__ . ':' . __LINE__);
}
[PHP] TypoScript usage in backend- or comand context
From time to time you need TypoScript in the backend or in a command in TYPO3. The following example shows you how to get there:
"Code faster, look at the time" - does this sound familiar to you?
How about time and respect for code quality? Working in a team? Automated tests?