[TYPO3] Force Language and L-parameter
Ralf Hettinger
ng at ralfhettinger.de
Thu Dec 28 22:41:13 CET 2006
Hi Stefan,
Stefan Steinbeck schrieb:
> just today I stumbled about a similar problem - the domain should set
> the content language. I found only partial solutions for this problem.
> Only your code would set the links of the menu right, though nothing
> else was changed.
That's the point why I left it down here... couldn't find a similar solution either.
> Somehow the L variable was only set partially, as the
> result of this test shows:
>
> page.1 = TEXT
> page.1.value = L="{GPvar:L}"
> page.1.insertData = 1
> page.2 = TEXT
> page.2.value = L is undefined
> [globalVar = GP:L = 0]
> page.2.value = L=0
> [globalVar = GP:L = 1]
> page.2.value = L=1
>
> The results was the following:
>
> L="1"
> L is undefined
>
> Do you know why the second test did not work/GP:L was not set?
Well... as I'm just as by today in need of this little snippet I spent some more
time diving into the code. I'll explain this a bit further - if not for you then
for others who might stumble about it; feel free to ignore the technical stuff ;)
---
The problem is that the the TS-includeLib will be eventually evaluated after
fetching the TS-template and therefore any TS-condition will have already been
resolved at this point of time by the conditions (and GET vars) which where
right then - so your page.2 test has to fail.
I believe that your page.1 test passes becaused it is evalled at runtime... but
haven't checked this since it works as expected.
So -to make this bit a bit more confusing- if you put the TS-includeLibs into a
TS-condition which result is supposed to be changed by the includedLib-script
... that won't work in any case, since the includeLib will never be included
(uhm. sounds strange? that's like it is ;) )
If you make sure that this isn't a problem for your template (means: you didn't
put your TS-includeLib statement into a TS-condition which is only valid after
the included script) you might fix things to pass (at least) your page.2 test -
only you'd need to redo things which have been done before; like evalling the
TS-template (see snippet below) :(
This might have performance issues on complex TS-Templates but I didn't
experience any of them. Also, this isn't a complete redo since I believe it
doesn't has to be for setting up language specific setups. If in doubt, have a
look at tslib/index_ts.php
---
So - after all - here's a more complex includeLib script and voila: page.2 test
passes:
<?php
if (t3lib_div::_GET('L')=='') {
$GLOBALS['TSFE']->linkVars.='&L=0';
t3lib_div::_GETset('0','L');
$_GET['L'] = 0;
// redo some possibly language relevant TSFE template tasks (@see index_ts.php)
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->getFromCache();
$GLOBALS['TSFE']->getConfigArray();
$GLOBALS['TSFE']->convPOSTCharset();
$GLOBALS['TSFE']->settingLanguage();
$GLOBALS['TSFE']->settingLocale();
}
?>
> Another task I failed to solve was to bring your code to the top of in
> includeLibs list to make the L change available to the other extensions.
I'm not quite sure but it might be fixed by the modified script.
Could you check and let me know?
Ralf
> Ralf Hettinger wrote:
>
>>
>> <?php
>> if (t3lib_div::_GET('L')=='') {
>> $GLOBALS['TSFE']->linkVars.='&L=1';
>> t3lib_div::_GETset('1','L');
>> }
>> ?>
>>
More information about the TYPO3-english
mailing list