[Typo3] how to get FE TS into BE Module

Robert Lemke robert at typo3.org
Sat May 21 10:14:34 CEST 2005


Hi Lars,

Lars Haerig wrote:

> as i am currently working on a backen module for the tt_products
> extension, i will need the typoscript values from the frontend of the
> given page.
> 
> is there a way to get the typoscript-code.
> currently i need the array of
> plugin.tt_products.statusCodes
> cause i want to prevent hardcoded statusCodes in the BE-Module to make it
> as dynamically as it can be.

Generally, the TS templates are not meant to be parsed by BE modules, you
would use page TSconfig instead. But in your case it makes sense - and it
is possible by using the TS parser directly.

Here's the code (untested though):

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

$pageUid = 1234; // You need to set the page id, if it's a web BE module, 
                //just use $this->id

$sysPageObj = t3lib_div::makeInstance ('t3lib_pageSelect');
$rootLine = $sysPageObj->getRootLine ($pageUid);

$templateObj = t3lib_div::makeInstance('t3lib_tsparser_ext');
$templateObj->tt_track = 0;
$templateObj->init();
$templateObj->runThroughTemplates ($rootLine);
$templateObj->generateConfig();

debug ($templateObj->steup['plugin.']['tt_products.']['statusCodes']);

-- 
robert



More information about the TYPO3-english mailing list