0

我在 TYPO3 中遇到了 tt_news 的问题。

如果我在详细信息页面上,则会有一个带有一些 get 变量的 url。如果我在网站上切换页面语言,我会丢失正确的 url。

谁能帮我配置tt_news。我想站在同一个详细信息页面上,不同之处在于内容是其他语言吗?

4

4 回答 4

0

几年前我遇到了完全相同的问题,并想出了以下代码段:

lib.logo = TEXT
lib.logo {
    typolink {
        parameter.data = TSFE:id
        returnLast = url

        addQueryString = 1
        addQueryString {
            method = GET
            exclude = cHash, no_cache, id, FE_SESSION_KEY, L
        }

        additionalParams = &L=1
    }
}

此代码生成的链接包含所有 GET 变量(感谢addQueryString),但以下情况除外:

  • cHash(用于缓存)
  • no_cache(强制禁用缓存)
  • id(我们要设置的当前页面的id)
  • FE_SESSION_KEY(用于跨域链接以保持会话)
  • L(语言记录的 id)
于 2013-06-13T08:16:49.300 回答
0

如果您发布您的 TypoScript 来创建您的语言切换,它会更容易提供帮助。

但主要原则是:

  # change the links you have defined, to add the QueryString Parameters
  # so it will work with other extensions too
  ...typolink.addQueryString = 1
  ...typolink.addQueryString.methode = G

如果要明确定义应使用哪些参数:

  # of define on your own which parameters should be added:
  ...typolink.additionalParams.append = COA
  ...typolink.additionalParams.append {
     10 = TEXT
     10.data = GP:tt_news[uid]
     10.required = 1
     # sanitize your url
     10.rawUrlEncode = 1
     10.wrap = &tt_news[uid]=|

     # and so on
     20 = TEXT

  }

如果您不想要重复的参数:

  # check for duplicate parameters
  config.uniqueLinkVars = 1
于 2013-06-13T08:09:44.367 回答
0

去啊哈德与这个。只需注意 TYPO3 v4GPvar:但在 TYPO3 v6GP :

####### LANGUAGE SELECTOR #######
lib.langMneu = HMENU
lib.langMneu.30 {  
      wrap = <ul class="lang"> | </ul></div>
      special = language
      special.value = 0,1,2
      special.normalWhenNoLanguage = 0
      1 = TMENU
      1 {
      noBlur = 1
      NO = 1
      NO {
        additionalParams.cObject = COA
        additionalParams.cObject {
          5 = TEXT
          5.wrap = &L=1

          10 = TEXT
          10.data = GP : tx_ttnews | backPid
          10.wrap = &tx_ttnews[backPid]=|
          10.required = 1

          20 = TEXT
          20.data = GP : tx_ttnews | tt_news
          20.wrap = &tx_ttnews[tt_news]=|
          20.required = 1

          30 = TEXT
          30.data = GP : cHash
          30.wrap = &cHash=|
          30.required = 1        
        }
      linkWrap = <li class="eng">|</li>||<li class="de">|</li>||<li class="ru">|</li>
      stdWrap.override = Eng||De||Rus
      doNotLinkIt = 0


      stdWrap.typolink.additionalParams = &L=0||&L=1||&L=3
      stdWrap.typolink.addQueryString = 1
      stdWrap.typolink.addQueryString.exclude = L,id,cHash,no_cache
      stdWrap.typolink.addQueryString.method = GET 
      stdWrap.typolink.useCacheHash = 1
      stdWrap.typolink.no_cache = 0
    }
      # Active
      ACT = 0
      ACT <.NO
      ACT.linkWrap = <li class="current eng">|</li>||<li class="current de">|</li>||<li class="current ru">|</li>
      #ACT.ATagParams = class="cur"
      #USERDEF1 <.NO
      #USERDEF2 < .ACT
      }
    }
####### END LANGUAGE SELECTOR #######
于 2017-05-06T12:22:17.047 回答
0

语言切换和 tx_news 的示例,基于 maholz 的回答:

lib.langNavi = HMENU
lib.langNavi {
  special = language
  special.value = 0,1
  1 = TMENU
  1 {

        NO = 1
        NO.allWrap = |*| | &nbsp;&#124;&nbsp;  |*| |
        NO.linkWrap = |
        NO.stdWrap.setCurrent = Deutsch || English
        NO.stdWrap.current = 1
        NO.additionalParams {
            append = COA
            append {
                10 = TEXT
                10.data = GP:tx_news_pi1|news
                10.required = 1
                # sanitize your url
                10.rawUrlEncode = 1
                10.wrap = &tx_news_pi1[news]=|
            }
        }

        # Current language selected:
        ACT < .NO
        ACT.linkWrap = <strong> | </strong>

        # Language that is NOT available:
        USERDEF1 < .NO
        USERDEF1.linkWrap = <span class="text-muted"> | </span>
        USERDEF1.doNotLinkIt = 1

  }
}
于 2016-07-21T14:10:03.680 回答