[TYPO3-english] Get Typoscript from an action controller (Typo3 6.2)

Sergio Catalá scatala.enet at gmail.com
Wed Jan 14 16:28:34 CET 2015


Hi list,

I've been using this function until now to get the value of a TS constant
from a function of an ActionController (Extbase):

    public function getTyposcriptConstantByKey($key) {

        require_once(PATH_t3lib . 'class.t3lib_tstemplate.php');
        require_once(PATH_t3lib . 'class.t3lib_page.php');

        // Initialize the page selector
        $sysPage =
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect');
        $sysPage->init(TRUE);

        // Initialize the TS template
        $template =
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_TStemplate');
        $template->init();

        // Avoid an error
        $template->tt_track = 0;

        // Get rootline for current PID
        $rootline = $sysPage->getRootLine(1);

        // Start TS template
        $template->start($rootline);

        // Generate config
        $template->generateConfig();

        $constants = $template->flatSetup;

        return $constants[$key];
    }

After upgrading to Typo3 6.2, these libs don't exist anymore. Any
suggestion to get the Typoscript from a function?

Thanks in advance,
Sergio


More information about the TYPO3-english mailing list