[Typo3-dev] getting values from locallang_db.php for frontend output

JoH info at cybercraft.de
Tue Jun 21 21:26:55 CEST 2005


> t3lib_div (and some other t3lib classes and objects, e.g.
> $GLOBALS['TYPO3_DB']) are available in the FE, of course, since
> they're needed there also.
>
> Back to you problem:
> tslib_fe::readLLfile() uses t3lib_div::getFileAbsFileName() to get the
> real filename. You can use tslib_fe::readLLfile() the way you want
> to, but you have to put the extension key after "EXT:". Something like
>
> $labels =
> $GLOBALS['TSFE']->readLLfile('EXT:some_extension/locallang_db.php');
>
> should do.

Well - it would have done if I hadn't forgotten to fill in the extension
name before locallang_db.php
Have got "the runs" for a few days now and maybe I'm not just losing water
but cerebral substance too ;-)

> But in your OP you asked for the "preferrable way" to include LL
> labels. When I looked at tslib_fe I also found (just before
> readLLfile()) the function tslib_fe::sL(). It does the same for FE as
> language::sL() does for BE. $GLOBALS['LANG'] is one of the
> classes/objects that's not available in FE, but some of it's
> functionality is realized in tslib_fe. The syntax for the label key
> is similar to the syntax used for "title" in the "ctrl" section of
> $TCA [1]. The contents of every file that's opened by tslib_fe::sL()
> are cached so there's no performance issue. Additionaly this function
> also takes care of charset conversion.
>
> IMHO the "preferrable way" is to leave the label management to the
> core and use tslib_fe::sL() like
>
> $label =
> $GLOBALS['TSFE']->sL('LLL:EXT:some_extension/locallang_db.php:label_key');

Well - this definitely is the preferrable and most comfortable way.
Works like a charm.

Thanx a lot

Joey


-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.openbc.com/go/invuid/Jo_Hasenau






More information about the TYPO3-dev mailing list