简体   繁体   English

TYPO3 8.7.0不包含TypoScript

[英]TYPO3 8.7.0 does not include TypoScript

I use TYPO3 with bootstrap package and try to include a backend layout from file. 我将TYPO3与bootstrap包一起使用,并尝试包含文件的后端布局。

I added this TypoScript in Template > Home > Edit ... > Constants: 我在模板>主页>编辑...>常量中添加了此TypoScript:

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

test.txt is a copy of a default.txt with "title=Test". test.txt是带有“ title = Test”的default.txt的副本。

However, I am unable to select the backend layout "Test" in the page module. 但是,我无法在页面模块中选择后端布局“测试”。

Has anyone a hint? 有没有人暗示?

first things first: You might want to include your template files in your own template extension, rather than saving it under fileadmin. 首先,您可能需要将模板文件包含在自己的模板扩展名中,而不是将其保存在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. 其背后的原因是,fileadmin文件夹通常是公共资源,每个人都可以访问,并且可由后端用户在filelist-module中浏览。 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. 现在解决您的问题,您将TypoScript与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. 两者并不相同,因为TypoScript用于在前端呈现页面,而TSConfig用于配置后端。 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 . 因此,要将新的后端布局添加到页面记录,需要将已复制的文件内容添加到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配置文件添加到以下文件中: your_template_ext/Configuration/TCA/Overrides/pages.php ,如下所示:

<?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 如果您需要一个示例,请更深入地了解bootstrap_package或我创建的我的“基本”扩展名,该扩展名完全符合我在此处描述的内容: https : //github.com/the-coding-owl/kd_base/tree/主/配置

that should be: 应该是:

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

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

pay also attention to capital letters (it's case sensitive) 也要注意大写字母(区分大小写)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM