[TYPO3-dev] get language labels from random extension

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Tue Sep 11 09:32:35 CEST 2007


Brian Bendtsen schrieb:
> Dmitry Dulepov [typo3] skrev:
>> Brian Bendtsen wrote:
>>> Yeah I figured as much, but I still get the error.
>>
>> It means that $GLOBALS['LANG'] is not instantiated. You have to do it 
>> yourself...
>>
> Ok, im a newbie php programmer but I have tried to do so like this:
> 
> require_once (PATH_site . 'typo3/sysext/lang/lang.php');
> $langObj = t3lib_div::makeInstance('language');
> 
> and then I call the function like this:
> 
> $langobj->includeLLFile('typo3conf/ext/indmeldelse/locallang_db.xml');
> 
> but apparently this is not the right way, since I get the same error.
> 
> A little help please

The point is that you assign to $langobj and not $LANG. Depending on where 
the assignment takes place (inside a function) you must use $GLOBALS['LANG'].

Try this:

<?php

$this_is_global = 1;

function x() {
   $this_is_local = 2;
   $GLOBALS['this_is_global'] = 3;
}

echo "$this_is_global\n";
x();
echo "$this_is_global\n";

?>

Masi




More information about the TYPO3-dev mailing list