[Typo3-dev] pi_getLL() from own classes

Volker Biberger info at sitekick.de
Mon Sep 27 15:09:23 CEST 2004


I am well aware of using the functions within my _pi.php, but that was 
not what I meant.

I introduced a new class

new someclass {
	var $anything;

	function doSomething()
		return $????-> pi_getLL('label');
	}
}

my mainclass calls it using
$myclass = new someclass;
$this->content = $myclass->doSomething();

I hope this clearifies my problem.

Thanks for your reply. I apprechiate it.
Volker

On 2004-09-27 14:04:38 +0200, Rainer Kuhn <kuhn at punkt.de> said:

> 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