【问题标题】:TYPO3: plugin not showing up in backendTYPO3:插件未显示在后端
【发布时间】:2018-10-03 17:24:19
【问题描述】:

这是 T3 v7.7.25,我尝试构建我的第一个扩展。这个想法是在后端有一个可选择的内容元素,其 html 模板文件只做一个 php echo。

我的 emconf:

<?php

$EM_CONF[$_EXTKEY] = [
        'title' => 'Robert PHP',
        'description' => 'An extension to use PHP.',
        'category' => 'plugin',
        'author' => 'John Doe',
        'author_company' => 'John Doe Inc.',
        'author_email' => 'john.doe@example.com',
        'state' => 'alpha',
        'clearCacheOnLoad' => true,
        'version' => '0.0.0',
        'constraints' => array(
            'depends' => array(
            'extbase' => '6.0',
            'fluid' => '6.0',
            'typo3' => '6.0',
            )
        )
];

我的 ext_tables:

<?php

    if(!defined('TYPO3_MODE')) die ('Access denied.');


    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
        $_EXTKEY,
        'Robert',
        'Beschreibung fuer Auswahl'
    );

我的本​​地配置:

<?php

    if(!defined('TYPO3_MODE')) die ('Access denied.');

    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        $_EXTKEY,
        'Robert',
        array(
            'Php' => 'include'
        ),
        array()
    );

我的控制器:

<?php

    class Tx_RobertPhp_Controller_PhpController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
    {
        public function includeAction() {

        }
    }

我的模板:

<?php
echo "echo aus der ext";
?>

我无法在后端选择插件,所以 registerPlugin 一定有问题。但由于我没有看到任何错误消息,我发现很难找到问题所在?

【问题讨论】:

    标签: typo3


    【解决方案1】:

    首先,您不能在 Fluid 模板中使用 PHP 标签。 Extbase 控制器中的操作正在使用流体模板。

    流体模板必须位于正确的位置:Resources/Private/Templates/[ControllerName]/[ActionName].html。在您的情况下,它应该是 Resources/Private/Templates/Php/Include.html

    请使用命名空间,它是 PHP 5.3 引入的。

    看看其他扩展,例如博客示例。

    【讨论】:

    • 是的,Thomas,这正是我放置模板的地方(如教程中所述)。除了 php+fluid 问题:你是说插件没有出现在后端的原因是因为我不使用命名空间?
    • 如果我点击“通用插件”就可以了。从那里我可以在“插件”选项卡中选择我的插件。当我点击“添加内容元素”和“插件”时,我期待我的插件会出现。为什么会这样隐藏?
    • 如果你想在“新内容”向导中添加你的内容元素,你需要像这里提到的那样添加 PageTS:usetypo3.com/custom-fsc-element.html#c13
    【解决方案2】:

    TYPO3 前端插件在ext_localconf.php 文件中注册。如果要添加后端模块,则需要在ext_tables.php 中添加 registerPlugin,否则不需要。

    还有你的ext_localconf.php 文件插件配置,如下所示。

    <?php
    defined('TYPO3_MODE') || die('Access denied.');
    
    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'MyVendor.extensionkey',
        'plugin_name',
        array(
            'Controller' => 'action',
        ),
        // non-cacheable actions
        array(
            'Controller' => '',
        )
    );
    

    您还需要根据上述答案指定流体模板路径。有关 extbase 扩展的更多详细信息,请点击此处Extbase Extension

    【讨论】:

    • 这没有帮助,我确实在正确的位置有一个模板,我根据你更改了 localconf。我仍然没有看到任何插件可供选择:/
    • 在需要安装/卸载扩展后添加您的更改。你这样做了吗?
    • 另外,请使用最新更改更新您的问题。所以我可以检查一下。
    • 我找到了原因,请在 Thomas 的回答下方查看我的评论!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多