[TYPO3-dev] tslib_pibase can't fetch translations, pi_getLL()

Dmitry Dulepov [typo3] dmitry at typo3.org
Fri May 2 18:49:04 CEST 2008


Cyrill Helg wrote:
> May I ask how to do that? Just pass the $this object when creating the 
> instance?
> 
> $controller = new tx_myext_controller($this); 

You do not to things like this in TYPO3. Correct code would be:

$className = t3lib_div::makeInstanceClassName(tx_myext_controller);
$controller = new $className($this);

Never ever use "new" with TYPO3 in your code.

In class.tx_myext_controller.php:

class tx_myext_controller {

	var $pObj;

	function __construct(&$pObj) {
		$this->pObj = $pObj;
	}

	function foo() {
		$str = $this->pObj->pi_getLL('idstr');
	}
}

-- 
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"




More information about the TYPO3-dev mailing list