简体   繁体   English

流体变量的typo3语言条件

[英]typo3 language condition for fluid variable

my HTML looks like this: 我的HTML看起来像这样:

 <a href="<f:format.raw>{twitter_link}</f:format.raw>" target="_blank">Link to twitter</a>    

In my case, I have 2 diffrent twitter-accounts, an english one, and a german one. 就我而言,我有2个不同的twitter帐户,一个是英国帐户,另一个是德国帐户。

So I thought, i'll check the language the current site, and modify the link: 所以我想,我将检查当前站点的语言,然后修改链接:

TypoScript 打字脚本

  twitter_link = TEXT

  [globalVar = TSFE:sys_language_uid = 1]
  twitter_link.value = http://www.twitter.com/myFirstAccount
  [global]

  [globalVar = TSFE:sys_language_uid = 0]
  twitter_link.value = http://www.twitter.com/mySecondAccount
  [global]

It simply doesn't work. 它根本不起作用。 It always just displays the first given value. 它始终只显示第一个给定值。 It seems like, the conditions are not checked correctly. 看来,条件没有正确检查。

I also tried: 我也尝试过:

[globalVar = GP:L=0]
// do german stuff here
[global]

[globalVar = GP:L=1]
// do english stuff here
[global]

However, if I use something like: 但是,如果我使用类似:

10 = TEXT
10.data = TSFE:sys_language_uid
10.wrap = -- lang-id: | --

It is correct. 它是正确的。 A normal check with an if didn't work, or I havn't found any "normal" if's in TypoScript. 使用if进行的常规检查不起作用,或者我在TypoScript中找不到任何“常规”的if。 Any ideas? 有任何想法吗?

thank you 谢谢

Your typoscript doesn't have any relation to the plugin. 您的打字稿与插件没有任何关系。 Should look like this: 应该看起来像这样:

plugin.<your_pluginname>.settings.twitter_link = http://www.twitter.com/myFirstAccount

[globalVar = GP:L=1]
  plugin.<your_pluginname>.settings.twitter_link = http://www.twitter.com/mySecondAccount
[global]

You can then access "twitter_link" in your controller via $this->settings['twitter_link']. 然后,您可以通过$ this-> settings ['twitter_link']访问控制器中的“ twitter_link”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM