Typo3 eID,如何访问配置 [英] Typo3 eID, how to access config

查看:33
本文介绍了Typo3 eID,如何访问配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 Typo3 中创建了一个 eID.我不知道如何从 Typo3 实例访问我的插件的配置数据.

I've just created an eID in Typo3. I can't figure out how to access the config data for my plugin from the Typo3 instance.

我已经尝试了链接中的代码,但它不想工作.在调用$TSFE->getConfigArray();"时,我不断收到异常未找到 TypoScript 模板!"

I've tried the code from the link but it doesn't want to work. I keep getting an exception "No TypoScript template found! " on the call " $TSFE->getConfigArray(); "

http://lists.typo3.org/pipermail/typo3-dev/2006-December/021392.html

有什么想法吗?

谢谢.

推荐答案

在 eID 模式下,只加载了常规 TYPO3 前端的一小部分.不幸的是,没有加载 TypoScript.要仍然访问 TypoScript 配置,您需要手动加载所需的组件.不幸的是,这可能会让人有点头疼.因此,在某些情况下,只加载一个包含不包含任何其他内容(没有标题等)的单个插件的页面可能会更容易.

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.).

如果您确实想自己加载 TypoScript 模板,可以尝试以下操作:

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

require_once(PATH_tslib.'class.tslib_fe.php');
require_once(PATH_t3lib.'class.t3lib_userauth.php' );
require_once(PATH_tslib.'class.tslib_feuserauth.php');
require_once(PATH_t3lib.'class.t3lib_cs.php');
require_once(PATH_tslib.'class.tslib_content.php') ;
require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
require_once(PATH_t3lib.'class.t3lib_page.php');

$TSFEclassName = t3lib_div::makeInstanceClassName('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();

$cObj = t3lib_div::makeInstance('tslib_cObj');

这会初始化 TSFE 和 cObj,但也用于加载和解析 TypoScript 模板.您可能需要对(可能会踢出一些东西)进行一些修改

This initializes the TSFE and cObj but is also used to load and parse the TypoScript templates. You might need to make some modifications to (probably kick some things out)

代码来自以下博客文章的评论之一:http://sebastiaandejonge.com/blog/articles/2010/september/21/bringing-ajax-to-your-frontend-plugins/

The code came from one of the comments on the following blog post: http://sebastiaandejonge.com/blog/articles/2010/september/21/bringing-ajax-to-your-frontend-plugins/

祝你好运!

这篇关于Typo3 eID,如何访问配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆