TYPO3 8.7.0 不包含 TypoScript [英] TYPO3 8.7.0 does not include TypoScript

查看:25
本文介绍了TYPO3 8.7.0 不包含 TypoScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 TYPO3 与 bootstrap 包一起使用,并尝试从文件中包含后端布局.

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

我在模板 > 主页 > 编辑 ... > 常量中添加了这个 TypoScript:

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

test.txt 是带有title=Test"的 default.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.

有人给点提示吗?

推荐答案

第一件事:您可能希望将模板文件包含在您自己的模板扩展中,而不是将其保存在 fileadmin 下.这背后的原因是,fileadmin 文件夹通常是一个公共资源,每个人都可以访问,并且后端用户可以在文件列表模块中浏览.最重要的是,您可以更好地管理多个模板,只需通过扩展管理器启用它们即可.

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.

现在解决您的问题,您将 TypoScript 与 TSConfig 混合使用.两者不一样,因为 TypoScript 用于在前端渲染您的页面,其中 TSConfig 用于配置您的后端.因此,要将新的后端布局添加到页面记录中,您需要添加已复制到 your_template_ext/Configuration/TsConfig/Page/BackendLayout.tsconfig 的文件的内容.这是您自己的模板扩展派上用场的地方,因为您可以将 PHP 配置内容添加到文件中:your_template_ext/Configuration/TCA/Overrides/pages.php 如下所示:

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

然后,您可以在资源"选项卡下的页面记录中选择后端布局配置,保存记录后,您的后端布局将显示在外观"选项卡下的后端布局"字段中.如果您需要一个示例,请深入了解 bootstrap_package 或查看我自己创建的基本"扩展,它完全符合我在此处描述的内容:https://github.com/the-coding-owl/kd_base/tree/master/Configuration

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

这篇关于TYPO3 8.7.0 不包含 TypoScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆