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

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Sun Nov 15 21:57:54 CET 2009


That looks nice, I will try it!

Thanks!

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.'];
> 
> --
> Peter Klein
> 
> 
> "Patrick Broens" <patrick at netcreators.com> wrote in message 
> news:mailman.1.1258314437.19621.typo3-dev at lists.typo3.org...
>> Ries van Twisk wrote:
>>> On Nov 14, 2009, at 5:03 PM, Thomas Thasmo Deinhamer wrote:
>>>
>>>> Good evening!
>>>>
>>>> Does there exist a nifty way to get the final extension
>>>> typoscript configuration inside an eID script?
>>>>
>>>> I wanna use eID for performance reasons,
>>>> but can't use it without typoscript configuration.
>>>>
>>>> How's this done?
>>>>
>>>> Thanks a lot! =o)
>>> it's not...
>> It is ;-)
>>
>> But you need to initialize tslib_fe, which is a huge overhead for Ajax
>> functionality.
>>
>> First you make an instance of the tslib_fe class like:
>> $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe',
>> $GLOBALS['TYPO3_CONF_VARS'],
>> t3lib_div::_GP('id'),
>> t3lib_div::_GP('type'),
>> and more variables if you want
>> );
>> (please check your incoming values ;-)
>>
>> Do some other stuff (check if you need this)
>> $GLOBALS['TSFE']->connectToMySQL();
>> $GLOBALS['TSFE']->initFEuser();
>> $GLOBALS['TSFE']->determineId();
>> $GLOBALS['TSFE']->getCompressedTCarray();
>> $GLOBALS['TSFE']->initTemplate();
>> $GLOBALS['TSFE']->getConfigArray();
>>
>> And you can get the configuration at:
>> $configuration =
>> $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_yourextension_controller.'];
>>
>> It's not really recommended, but it is doable.
>>
>> Patrick
>>> let me explain,
>>>
>>> if you need typoscript AND you need eID,
>>> then you are out of luck.
>>>
>>> Usually if you need typoscript using some sort of Ajax call,
>>> then use a proper type number, it's not a lot slower
>>> then using typoscript within your eID (never made in serious
>>> measurements though...
>>>
>>> Depending on what you are doing, there are several solutions.
>>>
>>> What I did here http://www.cocktailsoftheworld.com/find-a-cocktail.html
>>> with
>>> my Ajax(eID calls it to prepare the complete list of ingredients and
>>> Cocktail
>>> names ands store them as a file. Then use that file within my eID.
>>>
>>> If that method can work for you, highly depends on what you are doing...
>>>
>>> Ries
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
> 
> 




More information about the TYPO3-dev mailing list