问题描述
我正在寻找一种测试我的extbase扩展名的方法.我使用两个不同的前端和后端模板路径.
I search for a way to test my extbase-extension. I work with two different templatepaths for front- and backend.
module.myext{
view {
templateRootPath = myext/Resources/Private/Backend/Templates/
partialRootPath = myext/Resources/Private/Backend/Partials/
layoutRootPath = myext/Resources/Private/Backend/Layouts/
}
}
backendmodule可以正常工作,但是我的测试不会得到不同的模板路径.如果我在ext_typoscript_setup.txt中将view.templateRootPath写入config.tx_extbase,它将起作用,但是在这种情况下,我所有的前端测试都不再起作用.解决此问题的最简单方法是合并模板路径并仅使用其中的一个,但是必须有解决此问题的方法.
The backendmodule works without any problem, but my test will not get the different templatepath. If i write the view.templateRootPath to config.tx_extbase in the ext_typoscript_setup.txt it works, but in this case all my frontendtests do not work any more. The simplest way to resolve this issue is to merge the templatepaths and work with only one, but there must be a way around this solution.
有人有主意吗?
推荐答案
您是否在根页面中静态添加了扩展程序设置?
Did you statically include the extension setup in your root page?
然后,只要将后端模块包含在Web工具中并在页面树中选择根页面,后端模块就应该起作用.
Then the backend module should work as long as you include it in the web tools and select the root page in the page-tree...
如果您将模块包含在用户工具中,则这是一个已知的错误.看到这里:
If you include your module in the user tools, this is a known bug. See here:
http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2011-December/011174.html
您可以将此代码放在您的* ext_localconf.php *中:
You could put this code in your *ext_localconf.php*:
if (TYPO3_MODE === 'BE') {
t3lib_extMgm::addTypoScript($_EXTKEY, 'constants', $tsIncludeConstants);
t3lib_extMgm::addTypoScript($_EXTKEY, 'setup', $tsIncludeSetup);
}
其中$tsIncludeXX
是您的TS代码,其中包含扩展程序的配置文件:
where $tsIncludeXX
is your TS code to include the configuration files of your extension:
$tsIncludeConstants = "<INCLUDE_TYPOSCRIPT: source=FILE:EXT:$_EXTKEY/Configuration/TypoScript/constants.txt>";
$tsIncludeSetup = "<INCLUDE_TYPOSCRIPT: source=FILE:EXT:$_EXTKEY/Configuration/TypoScript/setup.txt>";
这是一种蛮力,但是行得通...
This is kind of brute force, but it works...
这篇关于TYPO3 4.5 extbase测试后端模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!