[TYPO3-dev] [eID] $conf-Variable

Björn Kraus kraus at phoenix-medien.de
Fri Dec 15 11:55:54 CET 2006


Wow! Thanks Stefan for sharing your code! This really did the job :D

I'd like to see this in the eid tools class since retrieving of the PI's 
configuration is a common problem in TYPO3-AJAX developing. The need for 
this will be bigger with the launch of 4.1 when JSON or XAJAX will be 
part of the core distribution.

Thx in advance,
Bjoern Kraus

Stefan Geith schrieb:
> Björn Kraus schrieb:
>> Hi!
>>
>> Has there been any proper solution how to retrieve the $conf-Array on 
>> eID-calls?
>>
>> Franz Holzinger's solution doesn't work (for me) since the retrieved 
>> data is - as far as I can understand it - only some TS stuff of the 
>> page (e.g. RTE settings) which is quite different from the required TS 
>> setup for the PI. AND: it's still TS, not a nice PHP array ...
> 
> I did it like this:
> 
> <snip>
> // // // OK here we go after index.php&eID init ...
> // // //
> 
> define ('CRLF', "\r\n");
> define ('DQT', '"');
> define ('QT', "'");
> 
> // *********************
> // Libraries included
> // *********************
> $TT->push('Include Frontend libraries','');
>     require_once(PATH_tslib.'class.tslib_fe.php');
>     require_once(PATH_t3lib.'class.t3lib_page.php');
>     require_once(PATH_t3lib.'class.t3lib_userauth.php');
>     require_once(PATH_tslib.'class.tslib_feuserauth.php');
>     require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
>     require_once(PATH_t3lib.'class.t3lib_cs.php');
> $TT->pull();
> 
> // ***********************************
> // Create $TSFE object (TSFE = TypoScript Front End)
> // Connecting to database
> // ***********************************
> $temp_TSFEclassName=t3lib_div::makeInstanceClassName('tslib_fe');
> $TSFE = new $temp_TSFEclassName(
>         $TYPO3_CONF_VARS,
>         t3lib_div::_GP('id'),
>         t3lib_div::_GP('type'),
>         t3lib_div::_GP('no_cache'),
>         t3lib_div::_GP('cHash'),
>         t3lib_div::_GP('jumpurl'),
>         t3lib_div::_GP('MP'),
>         t3lib_div::_GP('RDCT')
>     );
> $TSFE->connectToMySQL();
> if ($TSFE->RDCT)    {$TSFE->sendRedirect();}
> 
> 
> // *******************
> // output compression
> // *******************
> if ($TYPO3_CONF_VARS['FE']['compressionLevel'])    {
>     ob_start();
>     require_once(PATH_t3lib.'class.gzip_encode.php');
> }
> 
> // *********
> // FE_USER
> // *********
> $TT->push('Front End user initialized','');
>     $TSFE->initFEuser();
> $TT->pull();
> 
> 
> 
> 
> 
> 
> // *****************************************
> // Proces the ID, type and other parameters
> // After this point we have an array, $page in TSFE, which is the
> page-record of the current page, $id
> // *****************************************
> $TT->push('Process ID','');
>     // not needed and doesnot work with realurl //
> $TSFE->checkAlternativeIdMethods();
>     $TSFE->clear_preview();
>     $TSFE->determineId();
> 
>         // Now, if there is a backend user logged in and he has NO 
> access to
> this page, then re-evaluate the id shown!
>     if ($TSFE->beUserLogin && 
> !$BE_USER->extPageReadAccess($TSFE->page))    {
> 
>             // Remove user
>         unset($BE_USER);
>         $TSFE->beUserLogin = 0;
> 
>             // Re-evaluate the page-id.
>         $TSFE->checkAlternativeIdMethods();
>         $TSFE->clear_preview();
>         $TSFE->determineId();
>     }
>     $TSFE->makeCacheHash();
> $TT->pull();
> 
> 
> // *******************************************
> // Get compressed $TCA-Array();
> // After this, we should now have a valid $TCA, though minimized
> // *******************************************
> $TSFE->getCompressedTCarray();
> 
> 
> // ********************************
> // Starts the template
> // *******************************
> $TT->push('Start Template','');
>     $TSFE->initTemplate();
>     $TSFE->tmpl->getFileName_backPath = PATH_site;
> $TT->pull();
> 
> 
> // ******************************************************
> // Get config if not already gotten
> // After this, we should have a valid config-array ready
> // ******************************************************
> $TSFE->getConfigArray();
> 
> $conf = $TSFE->tmpl->setup['plugin.']['tx_myplugin.'];
> ...
> </snip>
> 
> Maybe this helps ...
> 
> -
> 
> Stefan




More information about the TYPO3-dev mailing list