TYPO3扩展键

时间:2012-03-21 09:24:22

标签: php content-management-system typo3 typo3-tca

我正在编写TYPO3扩展,并且在扩展的主要方法中我需要获得扩展的绝对路径,所以我有这段代码:

...    
$extPth = t3lib_extMgm::extPath($_EXTKEY);
$tempUploadPth = $extPth.'/res/uploads';
return $tempUploadPth;
...

但是,当我运行该页面时,TYPO3会返回以下错误消息:

  

“TYPO3致命错误:扩展密钥”“未加载!”

在EM中,我配置了扩展键,以下是

中的属性
  

localconf.php

值得注意的是,引用相同属性的两行是重复的 - 我不知道是怎么发生的。我没有手动输入它们。

$TYPO3_CONF_VARS['EXT']['extList'] = 'info,perm,func,filelist,about,tsconfig_help,context_help,extra_page_cm_options,impexp,sys_note,tstemplate,tstemplate_ceditor,tstemplate_info,tstemplate_objbrowser,tstemplate_analyzer,func_wizards,wizard_crpages,wizard_sortpages,lowlevel,install,belog,beuser,aboutmodules,setup,taskcenter,info_pagetsconfig,viewpage,rtehtmlarea,css_styled_content,t3skin,t3editor,reports,felogin,form,introduction';

$TYPO3_CONF_VARS['EXT']['extList'] = 'extbase,css_styled_content,info,perm,func,filelist,about,tsconfig_help,extra_page_cm_options,impexp,sys_note,tstemplate,tstemplate_ceditor,tstemplate_info,tstemplate_objbrowser,tstemplate_analyzer,func_wizards,wizard_crpages,wizard_sortpages,lowlevel,install,belog,beuser,aboutmodules,setup,taskcenter,info_pagetsconfig,viewpage,rtehtmlarea,t3skin,t3editor,reports,felogin,form,introduction,rsaauth,saltedpasswords,fluid,version,workspaces,scheduler,linkvalidator,automaketemplate,realurl,tt_news,indexed_search,wt_spamshield,jquerycolorbox,kickstarter,player_profile,sponzorstvo_amer';    // Modified or inserted by TYPO3 Extension Manager. Modified or inserted by TYPO3 Core Update Manager. 

$TYPO3_CONF_VARS['EXT']['extList_FE'] = 'extbase,css_styled_content,install,rtehtmlarea,t3skin,felogin,form,introduction,rsaauth,saltedpasswords,fluid,version,workspaces,automaketemplate,realurl,tt_news,indexed_search,wt_spamshield,jquerycolorbox,kickstarter,player_profile,sponzorstvo_amer';    // Modified or inserted by TYPO3 Extension Manager. 

如您所见,最后两行输入了关键字“sponzorstvo_amer”,我仍然不知道为什么在使用全局变量$ _EXTKEY时出现此错误

有什么想法吗?

3 个答案:

答案 0 :(得分:3)

可能$_EXTKEY未定义?

如果我们检查经典的tt_news扩展,在开始时我们可以看到扩展密钥的手动定义:

... 
var $extKey = 'tt_news'; // The extension key.
...

因此,似乎在插件上下文中不应使用$_EXTKEY,例如,ext_tables.php中可以使用{{1}}。

答案 1 :(得分:1)

在* __ wizicon.php中,我使用了带

的引用文件
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey) . 'Resources/Private/Language/locallang.xml';

$ extKey在使用之前未设置为值。

我用extkey值替换了它,例如'tt_news',它为我解决了错误。所以现在是

$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('tt_news') . 'Resources/Private/Language/locallang.xml';

答案 2 :(得分:-1)

您是如何命名扩展程序文件夹的?文件夹名称=扩展密钥。如果不匹配,TYPO3将抛出此异常。

您在扩展程序代码中所做的事情与此无关。