【问题标题】:TYPO3 Multidomain Website Preview shows only Default LanguageTYPO3 多域网站预览仅显示默认语言
【发布时间】:2017-12-14 12:04:57
【问题描述】:

我正在使用TYPO3 7.6 与多域和多语言网站,您会看到下面的链接。我有一个页面树和rootpage_id 用于所有三种语言!

  1. 第一语言是德语 (L=0, https://www.renosan.de/)
  2. 第二语言是英语(L=1,https://www.renosan.net/
  3. 第三语言是波兰语 (L=2, https://www.renosan.pl/)

对于每种语言,我都使用自己的顶级域(de、net、pl)。我还在我的根页面插入了域记录(TYPO3-Backend List -> Rootpage -> Domain records)

如果我点击预览按钮(图片),预览会在新窗口中打开:

...但内容仍然是默认语言(德语)!我需要更改 TLD 以手动更改网站语言。这对我的编辑没有用,因为他们无法一键查看预览。

有人可以解释TYPO3的行为吗?

我也尝试从.net.pl 登录后端,但没有任何反应。它始终是默认预览。没有特殊的.htaccess 条目...

我的 TypoScript 设置

### default german
config {
  linkVars = L(0-2)
  uniqueLinkVars = 1

  sys_language_mode = content_fallback
  sys_language_overlay = hideNonTranslated
  sys_language_uid = 0

  language = de
  locale_all = de_DE.UTF8
  htmlTag_langKey = de
}


### english L=1
[globalString = IENV:HTTP_HOST = *renosan.net]
config {
    baseURL = https://www.renosan.net/
    sys_language_uid = 1
    language = en
    locale_all = en_GB.UTF8
    htmlTag_langKey = en
}
[GLOBAL]


### polski L=2
[globalString = IENV:HTTP_HOST = *renosan.pl]
config {
    baseURL = https://www.renosan.pl/
    sys_language_uid = 2
    language = pl
    locale_all = pl_PL.UTF8
    htmlTag_langKey = pl
}
[GLOBAL]

我已经找到了我个人realURL-conf 的问题。如果我尝试使用来自Ext:realURL的“autoconf”,后端的预览就可以了!

这是我个人的 realURL 配置文件:

<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
    'pagePath' => array(
        'type' => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'expireDays' => '3',
        'rootpage_id' => 1,
        'firstHitPathCache'=> 1
    ),
    'init' => array(
        'enableCHashCache' => 1,
        'respectSimulateStaticURLs' => 0,
        'postVarSet_failureMode' => '',
        'enableUrlDecodeCache' => 1,
        'enableUrlEncodeCache' => 1
    ),
    'preVars' => array(
        array(
            'GETvar' => 'L',
            'valueMap' => array(
                //'de' => '0',
                'en' => '1',
                'pl' => '2'
            ),
            'noMatch' => 'bypass',
        ),
        array(
            'GETvar' => 'no_cache',
            'valueMap' => array(
                'nc' => 1,
            ),
            'noMatch' => 'bypass',
        ),
    ),

    'fixedPostVars' => array(
        'newsDetailConfiguration' => array(
            array(
                'GETvar' => 'tx_news_pi1[action]',
                'valueMap' => array(
                    'detail' => '',
                ),
                'noMatch' => 'bypass',
            ),
            array(
                'GETvar' => 'tx_news_pi1[controller]',
                'valueMap' => array(
                    'News' => '',
                ),
                'noMatch' => 'bypass',
            ),

            array(
                'GETvar' => 'tx_news_pi1[news]',
                'lookUpTable' => array(
                    'table' => 'tx_news_domain_model_news',
                    'id_field' => 'uid',
                    'alias_field' => 'title',
                    'addWhereClause' => ' AND NOT deleted',
                    'useUniqueCache' => 1,
                    'useUniqueCache_conf' => array(
                        'strtolower' => 1,
                        'spaceCharacter' => '-',
                    ),
                    'languageGetVar' => 'L',
                    'languageExceptionUids' => '',
                    'languageField' => 'sys_language_uid',
                    'transOrigPointerField' => 'l10n_parent',
                    'autoUpdate' => 1,
                    'expireDays' => 180,
                ),
            ),
        ),

        '42' => 'newsDetailConfiguration',
        '43' => 'newsDetailConfiguration',
    ),
    'postVarSets' => array(
        '_DEFAULT' => array(
            'controller' => array(
                array(
                    'GETvar' => 'tx_news_pi1[action]',
                    'noMatch' => 'bypass',
                ),
                array(
                    'GETvar' => 'tx_news_pi1[controller]',
                    'noMatch' => 'bypass',
                ),
            ),
            'tags' => array(
                array(
                    'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
                    'lookUpTable' => array (
                        'table' => 'tx_news_domain_model_tag',
                        'id_field' => 'uid',
                        'alias_field' => 'title',
                        'addWhereClause' => 'AND NOT deleted',
                        'useUniqueCache' => 1,
                        'useUniqueCache_conf' => array (
                            'strtolower' => 1,
                            'spaceCharacter' => '-',
                        ),
                    ),
                ),
            ),

            'seite' => array(
                array(
                    'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
                ),
            ),

            // news archive parameters
            'archiv' => array(
                array(
                    'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                ),
                array(
                    'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                    'valueMap' => array(
                        'january' => '01',
                        'february' => '02',
                        'march' => '03',
                        'april' => '04',
                        'may' => '05',
                        'june' => '06',
                        'july' => '07',
                        'august' => '08',
                        'september' => '09',
                        'october' => '10',
                        'november' => '11',
                        'december' => '12',
                    ),
                ),
            ),

        ),
    ),
);



$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
    'encode' => array(
        array(
            'GETvar' => 'L',
            'value' => '0',
            'useConfiguration' => 'renosan.de',
            'urlPrepend' => 'https://www.renosan.de'
        ),
        array(
            'GETvar' => 'L',
            'value' => '1',
            'useConfiguration' => 'renosan.de',
            'urlPrepend' => 'https://www.renosan.net'
        ),
        [
            'GETvar' => 'L',
            'value' => '2',
            'useConfiguration' => 'renosan.de',
            'urlPrepend' => 'https://www.renosan.pl'
        ],

    ),
    'decode' => array(
        'renosan.de' => array(
            'GETvars' => array(
                'L' => '0',
            ),
            'useConfiguration' => 'renosan.de'
        ),
        'renosan.net' => array(
            'GETvars' => array(
                'L' => '1',
            ),
            'useConfiguration' => 'renosan.de'
        ),
        'renosan.pl' => array(
            'GETvars' => array(
                'L' => '2',
            ),
            'useConfiguration' => 'renosan.de'
        ),
    )
);
?>

感谢您的帮助.. 我仍然没有解决这个 TYPO3 问题?!它是 TYPO3 错误吗?我的 realURL-Configuration-File 有问题吗?

【问题讨论】:

    标签: typo3 preview multilingual multiple-domains realurl


    【解决方案1】:

    我认为你的条件是错误的,TYPO3 变得如此混乱以至于条件被完全忽略了。

    不是

    [global string = ENV: HTTP_HOST = ...
    

    但是:

    [globalString = ENV:HTTP_HOST = ...
    

    另一方面,我假设您的 TYPO3 也会对域和其他语言参数感到困惑。对于预览,您需要登录到 BE(cookie 依赖于域)。因此,只有使用语言参数才能预览另一种语言。您的配置混合了域和语言参数:如果您以 www.renosan.de?L=1 开头,则您的 baseurl 会更改。
    我的建议:根据域和 L-Param 拆分处理。

    【讨论】:

    • 首先,感谢您的回答。我会检查我的条件。由于 cookie,我还使用不同的域登录,例如 .net.pl 来测试它。什么也没有发生,“分裂”是什么意思。我需要 L 参数来管理语言,不是吗?
    • 一般来说尽量避免baseurl。如果您需要使用 baseurl,则在使用 L 参数时不要设置 baseurl。 => 域上的单独条件,设置相应的 baseurl。
    • 嗨 Bernd,现在我完全避免使用 baseURL。我现在使用absRefPrefix = auto (docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/…)。我的源代码中没有baseURL。我的条件仍然是[globalString = ENV:HTTP_HOST = https://www.renosan.net/] ... sys_language_uid = 1 ... f.e.
    • 嗨,伯恩德。现在我将 realURL 与 autoconf 一起使用,并且来自后端的预览工作。我自己的 realURLconf 有一些错误......它适用于 L-Parameter
    【解决方案2】:

    如果您使用 RealURL:请查看 this blog post。在这里您可以看到如何配置 realURL 以在域中观看以不同的语言。

    之后,您不需要有关域的条件。您可以使用简单的[globalVar = GP:L = x] 条件。

    【讨论】:

    • 好的,谢谢您的回复。我使用 realURL autoconf,现在将显示预览(使用 L 参数)。所以一定有某事。我的 realUrlConf 文件有问题?!?
    • 自动配置看不到域语言配置。所以必须手动配置realurl。
    • 也许你自己的配置错过了语言变量
    • 不,我已经有了。 preVars ... GETvar =&gt; 'L' ... 'de' =&gt; '0', 'en' =&gt; '1', ... 我将使用我自己的 realurl conf 对其进行测试。也许我已经改变了很多......所以我将为我的配置重新启动。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多