Connect to database with eID

蓝咒 提交于 2019-12-08 09:30:56

问题


I have a little question:

How do I connect an eid script in my extension with the MySQL database? What is the best practise to do so?


回答1:


This should be a good point to start:

<?php

/**
 * @var $TSFE \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
 */
$TSFE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController', $TYPO3_CONF_VARS, 0, 0);
\TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage();

// Get FE User Information
$TSFE->initFEuser();
// Important: no Cache for Ajax stuff
$TSFE->set_no_cache();

$TSFE->checkAlternativeIdMethods();
$TSFE->determineId();
$TSFE->initTemplate();
$TSFE->getConfigArray();
\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadConfigurationAndInitialize();

$TSFE->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
$TSFE->settingLanguage();
$TSFE->settingLocale();

/**
 * Initialize Database
 */
\TYPO3\CMS\Frontend\Utility\EidUtility::connectDB();

?>

The eID file must be registered in ext_localconf.php as follows:

$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['sha1Converter'] = 'EXT:myext/Classes/Eid/myEidFile.php';

If you want to use eID to work with Extbase, you should read this post as it is not suggested to use eID for applications where a lot of database requests are necessary.



来源:https://stackoverflow.com/questions/27989408/connect-to-database-with-eid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!