TYPO3:插件未显示在后端

时间:2018-04-23 15:38:15

标签: typo3

这是T3 v7.7.25,我尝试构建我的第一个扩展。我的想法是在后端有一个可选择的内容元素,其html模板文件除了php回声之外什么都不做。

我的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'
    );

我的localconf:

<?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必定存在问题。但是,由于我没有看到任何错误消息,我发现很难找到问题吗?

2 个答案:

答案 0 :(得分:0)

首先,您无法在Fluid模板中使用PHP标记。 Extbase Controller中的操作是使用流体模板。

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

请使用名称空间,它是在PHP 5.3中引入的。

只需查看其他扩展程序,例如博客示例。

答案 1 :(得分:0)

TYPO3前端插件已在ext_localconf.php文件中注册。如果你想添加Backend模块,那么你需要在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

相关问题