在TYPO3中无法确定扩展和插件的默认控制器为ERROR [英] The default controller for extension and plugin can not be determined ERROR in TYPO3
问题描述
我构建了一个扩展程序,并且想在将插件添加到页面时添加插件选项
Extension Name : hotels
在酒店模式下,
<?php
class Hotel{
... get set methods ...
}
?>
在HotelController.php中
<?php
namespace TYPO3\Hotels\Controller;
class HotelController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController{
public function listAction(){
// $this->view->assign('result', array('test' => 'hello, u r in list')); }
}
?>
在ext_localconf.php中
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'TYPO3.' . $_EXTKEY,
'hotels',
array('Hotel' => 'list,single,display,update,save,preview,edit')
);
在ext_tables.php中
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'hotels',
'list of Hotels'
);
$pluginSignature = str_replace('_','',$_EXTKEY) . '_hotels';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] ='pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_myhotel.xml');
不知何故,我想我缺少了一些东西.这给出了一个错误:
添加扩展名时,我可以在后端看到该选项,但是当我想显示(查看)添加扩展名的页面时,会产生错误.
----> The default controller for extension "Hotels" and plugin "hotels" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
请引导我
在TYPO3 6.x中,建议您使用命名空间类并告知configurePlugin
方法您的供应商名称.
由于您未包含任何控制器代码,因此我将尝试对其进行草绘:
- 首先,请确保使用命名空间控制器类-记住来设置供应商名称.
- 请确保您的操作以
*Action
后缀 命名
EXT:myext/Classes/Controller/HotelController
namespace MyVendor\MyExt\Controller;
class HotelController {
/**
* @return void
*/
public function listAction(){
}
}
接下来,像这样在configurePlugin中提及名称空间:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MyVendor.' . $_EXTKEY,
// UpperCamelCase please, refer to [1]
'Hotels',
array('Hotel' => 'list,single,display,update,save,preview,edit')
);
这允许类定位器正确解析类.
要进行验证,请确保您重新安装扩展程序.
PS:请尽可能在6.x中使用命名空间类.旧的Tx_*
类只是别名,会给您的解释器带来额外的负担.
1 >
更新: 有很多可能的错误. I built an extension and I would like to add plugin options at the time of adding the plugin to the page in Hotel model , in HotelController.php in ext_localconf.php in ext_tables.php Somehow, I think i'm missing something. This gives an error : I can see the option in backend side at time of adding extension but when i want to show (view) that Page where I add that extension , generates an error . Please Guide me In TYPO3 6.x, you are advised to use namespaced classes and tell the As you didnt include any of your controller code, I'll try to sketch it: EXT: myext/Classes/Controller/HotelController Next, mention the namespace in configurePlugin like this: This allows the class locator to resolve the classes correctly. To verify it, make sure you re-install your extension. PS: Please use the namespaced classes whenever possible in 6.x. The old 1 - TYPO3 API Docs for ExtensionUtility::configurePlugin() Update: There is a multitude of possible errors.
这篇关于在TYPO3中无法确定扩展和插件的默认控制器为ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
switchableControllerActions
?f:link.action
(或分别为f:uri.action)不喜欢没有适当的controller
属性HotelController
,并且文件必须位于Classes/Controller/HotelController.php
中,然后对configurePlugin()
进行调整以反映我所描述的vendorName Extension Name : hotels
<?php
class Hotel{
... get set methods ...
}
?>
<?php
namespace TYPO3\Hotels\Controller;
class HotelController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController{
public function listAction(){
// $this->view->assign('result', array('test' => 'hello, u r in list')); }
}
?>
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'TYPO3.' . $_EXTKEY,
'hotels',
array('Hotel' => 'list,single,display,update,save,preview,edit')
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'hotels',
'list of Hotels'
);
$pluginSignature = str_replace('_','',$_EXTKEY) . '_hotels';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] ='pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_myhotel.xml');
----> The default controller for extension "Hotels" and plugin "hotels" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
configurePlugin
method your vendor name.
*Action
suffixnamespace MyVendor\MyExt\Controller;
class HotelController {
/**
* @return void
*/
public function listAction(){
}
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MyVendor.' . $_EXTKEY,
// UpperCamelCase please, refer to [1]
'Hotels',
array('Hotel' => 'list,single,display,update,save,preview,edit')
);
Tx_*
classes are only aliases and put additional load on your interpreter.
switchableControllerActions
appropriately?f:link.action
(or f:uri.action respectively) doesnt like to be without an appropriate controller
attributeHotelController
and the file must live in Classes/Controller/HotelController.php
, then do the adjustments to configurePlugin()
to reflect the vendorName as I described