[TYPO3] how to generate link

Thorsten Kahler thorsten.kahler at dkd.de
Thu Aug 2 11:21:54 CEST 2007


Hi Jan,

Jan Bednarik wrote on 02.08.2007 10:39:
>> TYPO3 indeed doesn't implement the singleton pattern yet because of its
>> compatibility to PHP 4. But t3lib_div::getUserObj() offers a method to
>> use
>> objects as singletons (implemented as a kind of object repository).
> 
> Since when there's a problem with php4 and singleton. Let's see:
> http://www.developertutorials.com/tutorials/php/php-singleton-design-pattern-050729/page2.html
> 

I didn't say that there's a problem with singletons but with the singleton
/pattern/. (But see Elmars comment about that.)

> 
> or
> 
> function getInstance($classname) {
>     if (empty($GLOBALS['instances'][$classname])) {
>         $GLOBALS['instances'][$classname] = new $classname;
>     }
>     return $GLOBALS['instances'][$classname];
> }
> 

Did you take a look at t3lib_div::getUserObj()? ;-)

Regards
Thorsten


More information about the TYPO3-english mailing list