[Typo3-dev] pi_getLL() from own classes
Rainer Kuhn
kuhn at punkt.de
Mon Sep 27 14:04:38 CEST 2004
Volker Biberger wrote:
> when programming the sk_calendar I still couldn't figure out how I can
> make use of the Languagefunctions within my own classes. Like I can
> access DB-Funktions with $GLOBALS['DB']->somefunction...
>
> Has anyone done this before or can someone give me a hint on doing this?
Hi Volker,
assuming your extension is a frontend you can use the methods from class
tslib_pibase (see source code comments of the methods pi_loadLL() and
pi_getLL(): http://typo3api.ueckermann.de/class_8tslib__pibase_8php-source.html)
The following example for your file pi1/class.tx_skcalendar_pi1.php should
help you:
<?php
// include this TYPO3 class as it provides the
// locallang (LL) methods for frontent plugins
require_once(PATH_tslib."class.tslib_pibase.php");
// make your class an extension of the tslib_pibase class
class tx_skcalendar_pi1 extends tslib_pibase {
[...]
function main($content,$conf) {
[...]
// loads LOCAL_LANG array from locallang files
$this->pi_loadLL();
[...]
// example for including labels from LOCAL_LANG array
$content .= $this->pi_getLL("your_locallang_array_key_name",
"[alternative_label_if_not_found_in_array]");
[...]
}
[...]
}
?>
Good luck,
Rainer
More information about the TYPO3-dev
mailing list