TYPO3 tt_news细节与语言切换

时间:2013-06-12 15:06:43

标签: typo3 typoscript tt-news

我在TYPO3中遇到tt_news问题。

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

任何人都可以帮我配置tt_news。我想站在同一个详细信息页面,区别在于内容是用另一种语言编写的吗?

4 个答案:

答案 0 :(得分: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

答案 1 :(得分: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)

答案 2 :(得分:0)

语言切换和tx_news的一个例子,基于maholz的回答:

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

        NO = 1
        NO.allWrap = |*| |  |   |*| |
        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

  }
}

答案 3 :(得分:0)

跟这个去吧。只需在TYPO3 v4 GPvar:中付费,但在TYPO3 v6中GP :

####### 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 #######