Typo3 eID, how to access config OR fetch template from ajax file


In eID mode, only a small part of the regular TYPO3 frontend is loaded. Unfortunately TypoScript is not loaded. To still access the TypoScript configuration you need manually load the components it needs to do so. Unfortunately this can be a bit of a pain in the butt. So in some cases it might be easier to just load a page containing a single plugin that doesn’t contain anything else (without headers etc.).

If you do want to load the TypoScript templates yourself, you can try something like the following:

<?php //if (!defined (‘TYPO3_MODE’))die (‘Access denied.’);

ini_set(“display_errors”,1);

t3lib_div::requireOnce(PATH_tslib.’class.tslib_fe.php’);
t3lib_div::requireOnce(PATH_t3lib.’class.t3lib_userauth.php’ );
t3lib_div::requireOnce(PATH_tslib.’class.tslib_feuserauth.php’);
t3lib_div::requireOnce(PATH_t3lib.’class.t3lib_cs.php’);
t3lib_div::requireOnce(PATH_tslib.’class.tslib_content.php’) ;
t3lib_div::requireOnce(PATH_t3lib.’class.t3lib_tstemplate.php’);
t3lib_div::requireOnce(PATH_t3lib.’class.t3lib_page.php’);

$TSFEclassName = t3lib_div::makeInstance(‘tslib_fe’);
$id = isset($HTTP_GET_VARS[‘id’])?$HTTP_GET_VARS[‘id’]:0;

$GLOBALS[‘TSFE’] = new $TSFEclassName($TYPO3_CONF_VARS, $id, ‘0’, 1, ”,”,”,”);
$GLOBALS[‘TSFE’]->connectToMySQL();
$GLOBALS[‘TSFE’]->initFEuser();
$GLOBALS[‘TSFE’]->fetch_the_id();
$GLOBALS[‘TSFE’]->getPageAndRootline();
$GLOBALS[‘TSFE’]->initTemplate();
$GLOBALS[‘TSFE’]->tmpl->getFileName_backPath = PATH_site;
$GLOBALS[‘TSFE’]->forceTemplateParsing = 1;
$GLOBALS[‘TSFE’]->getConfigArray();

class CLASS_NAME {

  protected $uid;

  public function __construct() {
      tslib_eidtools::connectDB();
      $this->cObj = t3lib_div::makeInstance(‘tslib_cObj’);
  }

  public function main() {
      $templateFile = ‘EXT:EXTENSION_NAME/pi1/view/template.html’;
      $template = $this->cObj->fileResource($templateFile);
      $subpart = $this->cObj->getSubpart($template, ‘###TEMPLATE###’);
      $subpartArray = $linkpartArray = array();
      return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
  }

}

$obj = t3lib_div::makeInstance(‘CLASS_NAME’);

$obj->main();

// Make instance:

?>

Good Luck….. πŸ™‚

If you have any query then feel free to contact me at Jainish Senjaliya