[Typo3] TS: variables

Elmar Hinz elmar.hinz at vcd-berlin.de
Thu Sep 29 00:16:09 CEST 2005


Juraj Benadik wrote:
> Hi
> 
> 
> I'd like to set some variables accroding to domain names
> and use those variables rather than GP:L in further language dependand 
> settings:
> 
> varL=0
> 
> [globalString = IENV:HTTP_HOST = DEhost]
>   varL = 1
> [global]
> 
> [globalString = IENV:HTTP_HOST = ARhost]
>   varL = 2
> [global]
> 
> ...
> [globalVar = varL = 1]
>     # German mit L=1
>     config.sys_language_uid = 1
>     config.language = de
>     config.locale_all = de_DE
> [global]
> 
> 

Hello Juraj,

first of all it looks like a pretty idea to get rid of the ugly L. I 
would be curious if it works throughout.

Now to your probs. I guess the error results of trying to set 
"Variables". TS isn't a programming language. There you can't set global 
variables by writing varL=1 as you thought. You only set a small Part of 
the big TS Array with this.


I see at least 3 possibilities:


1.) You set configuration directly:

SETUP:

[globalString = IENV:HTTP_HOST = DEhost]
     config.sys_language_uid = 1
     config.language = de
     config.locale_all = de_DE
[global]

[globalString = IENV:HTTP_HOST = ARhost]
     config.sys_language_uid = 2
     [....]
[global]


2.) You use constants to make your setup more slim:

CONSTANTS:

varL=0

[globalString = IENV:HTTP_HOST = DEhost]
   my.uid = 1
   my.language = de
   my.locale = de_DE
[global]

[globalString = IENV:HTTP_HOST = XYhost]
   my.uid = 2
   my.language = xy
   my.locale = xy_XY
[global]


SETUP:

config.sys_language_uid = {$my.uid}
config.language = {$my.language}
config.locale_all = {$my.locale}



3.) You use a REGISTER, wich comes the closest to your idea of vars.

See TSref: LOAD_REGISTER


Greetings

Elmar


-- 
Climate change 2005: New Orleans, Sahel, Bangladesh, Spain, Portugal, 
Austria, Swiss, France, ...
Production of CO2 is killing people.
Production of CO2 just for fun is killing people just for fun.



More information about the TYPO3-english mailing list