Typo3后端加载前端模板

时间:2015-07-30 21:03:10

标签: typo3

我将自己的构建扩展复制到新的Typo3安装,但现在后端模板不再正确生成。在" old"安装它仍在工作。该扩展在后端有一个使用列表模板的配置菜单。它应该加载以下模板:

/ext/resources/backend/customers/list.html

但是扩展程序会加载以下内容:

/ext/resources/customers/list.html

在ext_tables.php中,它注册如下:

if (TYPO3_MODE === 'BE') {

    /**
     * Registers a Backend Module
     */
    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
        'MTR.' . $_EXTKEY,
        'user',  // Make module a submodule of 'user'
        'mtcus',    // Submodule key
        '',                     // Position
        array(
            'Customers' => 'list',
        ),
        array(
            'access' => 'user,group',
            'icon'   => 'EXT:' . $_EXTKEY . '/ext_icon.gif',
            'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mtcus.xlf',
        )
    );
}

2 个答案:

答案 0 :(得分:0)

经过大量的调查和参考,我能够找到插件的问题。当我使用Extension Builder创建后端模块时,创建的默认TS配置就像。例如,在TS文件中考虑扩展密钥为 testextension 且BE模块密钥为 custommodulebe ,模块模板路径已注册为。

IN constants.txt文件

module.tx_testextension_custommodulebe {
    view {
        # cat=module.tx_testextension_custommodulebe/file; type=string; label=Path to template root (BE)
        templateRootPath = EXT:testextension/Resources/Private/Backend/Templates/
        # cat=module.tx_testextension_custommodulebe/file; type=string; label=Path to template partials (BE)
        partialRootPath = EXT:testextension/Resources/Private/Backend/Partials/
        # cat=module.tx_testextension_custommodulebe/file; type=string; label=Path to template layouts (BE)
        layoutRootPath = EXT:testextension/Resources/Private/Backend/Layouts/
    }
    persistence {
        # cat=module.tx_testextension_custommodulebe//a; type=string; label=Default storage PID
        storagePid =
    }
}

IN setup.txt

module.tx_testextension_custommodulebe {
    persistence {
        storagePid = {$module.tx_testextension_custommodulebe.persistence.storagePid}
    }
    view {
        templateRootPath = {$module.tx_testextension_custommodulebe.view.templateRootPath}
        partialRootPath = {$module.tx_testextension_custommodulebe.view.partialRootPath}
        layoutRootPath = {$module.tx_testextension_custommodulebe.view.layoutRootPath}
    }
}
  

修复是我们只需要在此模块中定义扩展密钥   配置。

更正后的解决方案 constants.txt

module.tx_testextension {
    view {
        # cat=module.tx_testextension/file; type=string; label=Path to template root (BE)
        templateRootPath = EXT:testextension/Resources/Private/Backend/Templates/
        # cat=module.tx_testextension/file; type=string; label=Path to template partials (BE)
        partialRootPath = EXT:testextension/Resources/Private/Backend/Partials/
        # cat=module.tx_testextension/file; type=string; label=Path to template layouts (BE)
        layoutRootPath = EXT:testextension/Resources/Private/Backend/Layouts/
    }
    persistence {
        # cat=module.tx_testextension//a; type=string; label=Default storage PID
        storagePid =
    }
}

<强> SETUP.TXT

 # Module configuration
module.tx_testextension {
    persistence {
        storagePid = {$module.tx_testextension.persistence.storagePid}
    }
    view {
        templateRootPath = {$module.tx_testextension.view.templateRootPath}
        partialRootPath = {$module.tx_testextension.view.partialRootPath}
        layoutRootPath = {$module.tx_testextension.view.layoutRootPath}
    }
}

答案 1 :(得分:0)

尝试实现扩展程序的静态TypoScript模板。

Here is a visual Example