[TYPO3-english] Howto access TS Setup by condition userFunc?

Hendrik h.reimers at neonaut.de
Fri Feb 4 10:59:03 CET 2011


Thanks... here is the solution...

private function condLoadTS() {
		if ( empty($GLOBALS['TSFE']->tmpl->config) ) return false;
		
		$tsParser  = t3lib_div::makeInstance('t3lib_TSparser');
		$tsParser->parse(implode("\n",$GLOBALS['TSFE']->tmpl->config));
		$tsArray = $tsParser->setup;
		
		if ( sizeof($tsArray) > 0 ) {
			return $tsArray;
		} else return false;
	}

Am 04.02.2011 10:44, schrieb Sebastiaan de Jonge:
> Hi Hendrik,
>
> I see you are trying to manually load the TS Setup. runThroughTemplates is a
> very slow and inefficient way of doing this. The information you are looking
> for is probably already available inside $GLOBALS['TSFE']. To be more
> specific, the entire setup is available under:
>
> $GLOBALS['TSFE']->tmpl
>
> Try printing this from your user function, you will see all the options.
>
> Cheers,
> Sebastiaan
>
> --
>
> Kind regards,
> Sebastiaan de Jonge
>
> Freelance TYPO3 Developer - Certified TYPO3 Integrator
> w: http://sebastiaandejonge.com
> t: 0031 65431 7572
>
> On Fri, Feb 4, 2011 at 8:27 AM, Hendrik<h.reimers at neonaut.de>  wrote:
>
>> Hi,
>>
>> i want to access the full typoscript with a condition userfunc, but i have
>> problems to solve that.
>>
>> i've tried the following:
>>
>>                 // Require classes
>>                 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');
>>
>>                 // Init page id and the page object
>>                 $pid      = intval( (( $pageUid>  0 ) ? $pageUid :
>> t3lib_div::_GP('id')) );
>>                 $obj_page = t3lib_div::makeInstance('t3lib_pageSelect');
>>
>>                 // Init agregrated TypoScript
>>                 $rootline = $obj_page->getRootLine($pid);
>>                 if (empty($rootline)) return false;
>>
>>                 $obj_TypoScript =
>> t3lib_div::makeInstance('t3lib_tsparser_ext');
>>                 $obj_TypoScript->tt_track = 0;
>>                 $obj_TypoScript->init();
>>                 $obj_TypoScript->runThroughTemplates($rootline);
>>                 $obj_TypoScript->generateConfig();
>>                 die(print_r($obj_TypoScript->setup));
>>                 return $obj_TypoScript->setup;
>>
>> But this doens't work... it starts with a very long loadtime and ends with
>> a php memory limit error (php.ini memory_limit is 1024M).
>>
>> can anyone help me please?
>> thanks a lot...
>>
>> henny
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>>



More information about the TYPO3-english mailing list