简体   繁体   中英

TYPO3 8.7.0 does not include TypoScript

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?

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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