typo3 language condition for fluid variable

1.3k Views Asked by At

my HTML looks like this:

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

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. Any ideas?

thank you

1

There are 1 best solutions below

0
On

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'].