菜单

extbase update TS Setup

2015年09月17日 - typoscript
//site domain
        $baseURL = '';
        $templateData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_template', 'uid=1');
        $templateService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
        $templateService->ext_regObjectPositions($templateData['constants']);
        if(GeneralUtility::_GP('domain')){
            $urlInfo = parse_url(GeneralUtility::_GP('domain'));
            if(!isset($urlInfo['scheme'])){
                $baseURL = 'http://'.$urlInfo['path'].'/';
            }else{
                $baseURL = $urlInfo['scheme'].'://'.$urlInfo['host'].'/';
            }
        }
        $templateService->ext_putValueInConf('config.baseURL', $baseURL);
        // Set the data to be saved
        $recData = array();
        $recData['sys_template'][1]['constants'] = implode($templateService->raw, LF);
        // Create new  tce-object
        $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
        $tce->stripslashes_values = FALSE;
        $tce->start($recData, array());
        $tce->process_datamap();
        // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
        $tce->clear_cacheCmd('all');

发表评论

电子邮件地址不会被公开。 必填项已用*标注