[TYPO3-dev] How to get the extension typoscript configuration inside an eID script?

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Nov 16 11:19:28 CET 2009


Hi,

Peter Klein schrieb:

> If you don't need a full TSFE and only need to access some config 
> vars/options, then you can do something like this:
> 
> /* Classes required for creating a tmpl object */
> require_once(PATH_t3lib."class.t3lib_extobjbase.php");
> require_once(PATH_t3lib."class.t3lib_tsparser_ext.php");
> require_once(PATH_t3lib."class.t3lib_page.php");
> 
>     $pageId = <SET THIS TO THE ID OF THE CURRENT PAGE>;
> 
>    $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");
>    $tmpl->tt_track = 0; // Do not log time-performance information
>    $tmpl->init();
>    // Gets the rootLine
>    $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
>    $rootLine = $sys_page->getRootLine($pageId);
>    // This generates the constants/config + hierarchy info for the template.
>    $tmpl->runThroughTemplates($rootLine,0);
>    $tmpl->generateConfig();
> 
>     // Example: Get the TS config for the tt_news plugin
>    $ttnewsConf = $tmpl->setup['plugin.']['tt_news.'];

I think this is much worse than just using a page type.
runThroughTemplates() is very "dumb" and low level: it generates lots of
SQL queries to fetch your typoscript from rootline, parses it, includes
external files, extension typoscript, and at the end generates the
needed array.

In a full blown TSFE enrivonment you get all this with "one" query, as
it is already cached and can be served in no-time.

So apart from being more code to write, it will most probably not be
more performant than loading an USER_INT on an ajax "page" cObject. Or
maybe your ajax call can even be cached as an USER object, which is then
even faster!

Cheers,
Ernesto




More information about the TYPO3-dev mailing list