我有TYPO3 7.6.18并且我在前端尝试ajax并且我收到错误'扩展的默认控制器\“fefiles \”和插件\“piphoto \”无法确定'。
SETUP.TXT
ajaxCall = PAGE
ajaxCall {
typeNum = 22222
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
additionalHeaders = Content-type: text/plain
no_cache = 1
debug = 0
}
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = fefiles
pluginName = Piphoto
vendorName = Istar
controller = Photo
action = ajaxHandler
}
}
ext_tables.php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'Piphoto',
'Upload Photo'
);
JS
jQuery(function($) {
$(".send-photo-comment").click(function (e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "?id=0&type=22222",
data: {},
success: function(msg){
console.log(msg);
}
});
})
})
ext_localconf
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Istar.' . $_EXTKEY,
'Piphoto',
[
'Photo' => 'list, ajaxHandler, show, new, create, edit, update, delete',
],
// non-cacheable actions
[
'Photo' => 'list, ajaxHandler, show, new, create, edit, update, delete',
]
);
Help me please)
答案 0 :(得分:1)
您的ext_localconf.php
看起来如何?
应该包括:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Istar.' . $_EXTKEY,
'Piphoto,
array(
'Photo' => 'ajaxhandler'
)
);
答案 1 :(得分:0)
这基本上意味着您需要在ext_localconf.php中定义一个控制器。通常,第一个条目被视为默认控制器/操作。这是一个例子:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'YourVendor.' . $_EXTKEY,
// Plugin name
'Pi1',
// An array of controller-action combinations. The first one found is the default one.
array(
'YourController' => 'index,new,create,edit,update'
),
// An array of non-cachable controller-action-combinations (they must already be enabled)
array(
'YourController' => 'new,create,edit,update'
)
);