TYPO3 8.7.0 does not include TypoScript

放肆的年华 提交于 2019-12-12 04:08:16

问题


I use TYPO3 with bootstrap package and try to include a backend layout from file.

I added this TypoScript in Template > Home > Edit ... > Constants:

<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/typoscript/layouts/test.txt">

test.txt is a copy of a default.txt with "title=Test".

However, I am unable to select the backend layout "Test" in the page module.

Has anyone a hint?


回答1:


first things first: You might want to include your template files in your own template extension, rather than saving it under fileadmin. The reason behind this is, that the fileadmin folder usually is a public resource, accessible by everyone and browsable in the filelist-module by backend users. On top of that, you can manage multiple templates better, when they can simply enabled by extension manager.

Now to your problem, you mixed TypoScript with TSConfig. The two are not the same, because TypoScript is used to render your page in the frontend, where TSConfig is used to configure your backend. So to add a new backend layout to the page record, you need to add contents of the file you have copied to your_template_ext/Configuration/TsConfig/Page/BackendLayout.tsconfig. This is where your own template extension comes in handy, because you can add the PHP configuration stuff in a file: your_template_ext/Configuration/TCA/Overrides/pages.php that will look like this:

<?php
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile('your_template_ext', 'Configuration/TsConfig/Page/BackendLayout.tsconfig', 'Backend Layout');

You can then select your backend layout configuration in the pages record under the tab "Resources" and after saving the record, your backend layout will show up in the "Backend Layout" field under the "Appearance" tab. If you need an example, have a deeper look into the bootstrap_package or look at my own "base" extension I created that does exactly what I described here: https://github.com/the-coding-owl/kd_base/tree/master/Configuration




回答2:


that should be:

<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/typoscript/layouts/test.txt">

see https://wiki.typo3.org/INCLUDE_TYPOSCRIPT

pay also attention to capital letters (it's case sensitive)



来源:https://stackoverflow.com/questions/43553069/typo3-8-7-0-does-not-include-typoscript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!