TYPO3 - 使用语言特定路径而不是语言前缀与realurl

时间:2018-02-07 09:03:59

标签: typo3 realurl

我已在单树解决方案中设置了TYPO3安装(7.6)。所以使用realurl(2.3.1)我得到一个带有以下网址的德语版本的网页:www.domain.com/de/pfad-zur-seite和带有网址的英文版www.domain.com/en/path -to-页。 现在,不同的语言版本应该可以通过不同的路径获得。 德语版本应该是 www.domain.com/gruppe/magazin/pfad-zur-seite 英文版 www.domain.com/group/magazine/pfad-zur-seite 所以语言前缀de应该用gruppe / magazin替换,语言前缀en由group / magazine替换。我尝试在realurl_conf.php preVars-Section中更改它。但是只允许一个段(即组)不允许段(组/杂志)。 我怎样才能获得所需的网址?

以下是我的realurl和TYPO3设置:

<?php   
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array(
  '_DEFAULT' => array(
    'init' => array(
      'enableCHashCache' => 1,
      'appendMissingSlash' => 'ifNotFile',
      'enableUrlDecodeCache' => 1,
      'enableUrlEncodeCache' => 1,
      'postVarSet_failureMode' => '',
    ),
    'redirects' => array(),
    'preVars' => array(
      array(
        'GETvar' => 'no_cache',
          'valueMap' => array(
            'nc' => 1,
          ),
          'noMatch' => 'bypass',
        ),
        array(
          'GETvar' => 'L',
          'valueMap' => array(
             'de' => '0',
             'en' => '1',
          ),
          'valueDefault' => 'en',
        ),
      ),
      'pagePath' => array(
        'type' => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'expireDays' => 7,
        'rootpage_id' => 1,
        'firstHitPathCache' => 1,
      ),
    // postVars
    '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,
                                )
                        )
                ),
                'newsTagConfiguration' => 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' => '-'
                            )
                        )
                    )
                ),
                'newsCategoryConfiguration' => array(
                        array(
                                'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
                                'lookUpTable' => array(
                                        'table' => 'sys_category',
                                        'id_field' => 'uid',
                                        'alias_field' => 'title',
                                        'addWhereClause' => ' AND NOT deleted',
                                        'useUniqueCache' => 1,
                                        'useUniqueCache_conf' => array(
                                                'strtolower' => 1,
                                                'spaceCharacter' => '-'
                                        )
                                )
                        )
                ),

                '50' => 'newsDetailConfiguration',
                '8' => 'newsCategoryConfiguration',
                '8' => 'newsTagConfiguration',

        ),
        'postVarSets' => array(
                '_DEFAULT' => array(
                        'controller' => array(
                                array(
                                        'GETvar' => 'tx_news_pi1[action]',
                                        'noMatch' => 'bypass'
                                ),
                                array(
                                        'GETvar' => 'tx_news_pi1[controller]',
                                        'noMatch' => 'bypass'
                                )
                        ),

                        'dateFilter' => array(
                                array(
                                        'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                                ),
                                array(
                                        'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                                ),
                        ),
                        'page' => array(
                                array(
                                        'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
                                ),
                        ),
                ),
        ),



    // configure filenames for different pagetypes
    'fileName' => array(
      'defaultToHTMLsuffixOnPrev' => 0,
      'index' => array(
        'print.html' => array(
          'keyValues' => array(
            'type' => 98,
          ),
        ),
        'rss.xml' => array(
          'keyValues' => array(
            'type' => 100,
          ),
        ),
        'rss091.xml' => array(
          'keyValues' => array(
            'type' => 101,
          ),
        ),
        'rdf.xml' => array(
          'keyValues' => array(
            'type' => 102,
          ),
        ),
        'atom.xml' => array(
          'keyValues' => array(
            'type' => 103,
          ),
        ),
      ),
    ),
  ),
);

的TypoScript: 开发期间更改了默认语言。这就是为什么选择sys_language_uid = 1作为默认语言。

config {      

  linkVars = L(0-1)
  uniqueLinkVars = 1
  htmlTag_dir = ltr  

  htmlTag_langKey = en
  sys_language_uid = 1
  language = en
  locale_all = en_EN
  sys_language_overlay = hideNonTranslated
  # sys_language_overlay = content_fallback
  sys_language_mode = strict
}

# German language, sys_language.uid = 0
[globalVar = GP:L = 0]
config {
    language = de
    locale_all = de_DE.utf8
    htmlTag_langKey = de
    sys_language_uid = 0
}
[global]


# English language, sys_language.uid = 1
[globalVar = GP:L = 1]
config {
    language = en
    locale_all = en_EN.utf8
    htmlTag_langKey = en
    sys_language_uid = 1
}
[global]

0 个答案:

没有答案