how to insert the language id in a typolink in typoscript

7.3k views Asked by At

i want to add the language id in a typolink

so far

    LOGO = COA
    LOGO {
        10 = TEXT
        10 {
            value = logo
            typolink {
                parameter = 116
                additionalParams = &L={$config.sys_language_uid}
            }
        }
    }

if L=4 it's working

but if i use L={$config.sys_language_uid} it gets ignored altogether

same with L=GP:L and L=GPvar:L

what would be the proper syntax here

5

There are 5 answers

0
alex On BEST ANSWER

working if i do something like

                additionalParams = COA
                additionalParams {
                  10 = TEXT
                  10.data = GP : L
                  10.intval = 1
                  10.wrap = &L=|
                }
0
Jörg Leshel On

There is no need to make a cObject or COA

additionalParams = type=0&L={GP:L}
additionalParams.insertData = 1
1
Andrei Todorut On
3
maholtz On

You do not need to do that on your own. With the following global TypoScript configuration the parameter L will added to every link:

config.linkVars = L(int)

So, if you use HMENU.special = language this will be managed on the switch automatically, too:)

http://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html

0
Deividas Šimas On

I do not know about {$config.sys_language_uid}, but your code will output it as plain text. In order to use variables like {GP:L}, you got to dataWrap it or insert "insertData" after the value.

10 = TEXT
10 {
    value = logo
    typolink {
        parameter = 116
        additionalParams.dataWrap = &L={GP:L}
    }
}

OR (the best way I'd say):

10 = TEXT
10 {
    value = logo
    typolink {
        parameter = 116
        additionalParams.cObject = TEXT
        additionalParams.cObject {
            wrap = &L=|
            data = GP:L
        }
    }
}

Using {TSFE:sys_language_uid} might be a better option if you are querying the database.