使用TYPO3 9.5 LTS中的分发扩展来处理多域设置

问题描述

我在TYPO3 9.5.20 LTS中有一个多域设置,根据最佳实践经验,我应该使用发行版扩展为每个根目录提供Typoscript和模板。所以我做到了。

domainA模板包含:

  • fluid_styled_content
  • ...
  • 恩怨
  • templatea

domainB模板包含:

  • fluid_styled_content
  • ...
  • 恩怨
  • templateb

现在的问题是,在domainB中,我只能看到domainA的BE布局。

我该如何区分?如何将其限制在页面上?

我使用mod.web_layout.BackendLayouts在Configuration / TSConfig / Page.txt中定义布局。 在每个扩展名中,我都将{。{1}}中的Page.txt加载为:

ext_localconf.php

我当然在domainB中做templateb;)


旁注:对于tx_gridelements,我将其添加到Page.txt中来解决此问题:

<?php
if (!defined('TYPO3_MODE')) {
    die ('Access denied.');
}

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
    '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templatea/Configuration/TSConfig/Page.txt">'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
    '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templatea/Configuration/TSConfig/User.txt">'
);

但是此限制也仅在domainA中有效。

解决方法

一旦知道,解决方案就非常简单。 您不添加addPageTSConfig,也不添加ext_localconf.php。 只需创建一个/Configuration/TCA/Overrides/pages.php并添加:

\ TYPO3 \ CMS \ Core \ Utility \ ExtensionManagementUtility :: registerPageTSConfigFile( “ myextkey”, 'Configuration / TSConfig / Page.txt', “模板domainA PageTSConfig” );

删除缓存后,将页面设置转到“资源”,并通过“包含页面TSconfig(来自扩展名)”添加,保存并确认。

文档参考:https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/UsingSetting/Index.html#using-and-setting-tsconfig

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...