我有一个小问题:
如何将扩展程序中的eid脚本与MySQL数据库连接?这样做的最佳做法是什么?
答案 0 :(得分:0)
这应该是一个很好的开始:
<?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();
?>
eID文件必须在ext_localconf.php
中注册,如下所示:
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['sha1Converter'] = 'EXT:myext/Classes/Eid/myEidFile.php';
如果你想使用eID来使用Extbase,你应该阅读this post,因为不建议在需要大量数据库请求的应用程序中使用eID。