我已经构建了一个扩展程序,我使用Typoscript进行自举并将其置于模式框中。我也有相同的扩展名包含在页面元素中但具有不同的操作。
问题是当从页面中的扩展名调用其他操作时,它还反映了模式框中引导版本中显示的内容。我想做的是无论URL中的哪些参数(告诉扩展名要执行什么操作),模式框中的总是首先调用相同的操作。
这可能吗?
我是否应该为我的问题寻找不同的解决方案?
答案 0 :(得分:1)
在我看来,最简单的方法是AbstractContoller
,两个不同的控制器从中继承。
这种方式会完全分开但可以共享相同的动作:
namespace YOUR\Extension\Controller;
abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController{
public function firstAction(){
// your code here
}
public function secondAction(){
// your code here
}
}
第一控制器:
namespace YOUR\Extension\Controller;
class FirstController extends AbstractController{
//no need to add actions here
}
第二名管制员:
namespace YOUR\Extension\Controller;
class SecondController extends AbstractController{
//no need to add actions here
}
然后,您在页面上显示的拼写错误会调用FirstController->firstAction
,模式中的那个将调用SecondController->firstAction
。如果您通过GET传输不同的操作,它只会影响第一个或第二个控制器。
不要忘记:
答案 1 :(得分:0)
你是否在一个插件中调用了两个Controller / Action集合? 我会尝试像这样分裂他们
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $_EXTKEY,
'Pluginkey1',
array(
'FirstController' => 'foo, bar',
),
// non-cacheable actions
array(
'FirstController' => '',
)
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $_EXTKEY,
'Pluginkey2',
array(
'SecondController' => 'baz',
),
// non-cacheable actions
array(
'SecondController' => '',
)
);