[TYPO3-dev] Detecting the version of Typo3 for my extensio

Tapio Markula tapio.markula at dnainternet.net
Fri May 19 19:17:21 CEST 2006


Christian Trabold wrote:
> Hi Ingo,
> Hi Tapio,
> 
>>> I would need condition if($TypoVer >= 4.0)
>>>
>>> how I could get the version of Typo3?
>>
>>
>>
>> $version =
>> $GLOBALS['TYPO3_VERSION']?$GLOBALS['TYPO3_VERSION']:$GLOBALS['TYPO_VERSION']; 
>>
>>
>> always use $GLOBALS['TYPO3_VERSION']
> 
> 
> no. see below.
> 
> 
>> but as this variable is not available in older versions you need to check
>> for it and use $GLOBALS['TYPO_VERSION'] in case it is an old version and
>> thus not available.
> 
> 
> There is a constant TYPO3_version which you should use (according to 
> TYPO3 Core APIs Page 46 - PDF) - combined with the API call 
> t3lib_div::int_from_ver($version) you'll get a reliable value to work with.
> 
> eg
> 
> if (t3lib_div::int_from_ver(TYPO3_version) < 4000000) {
>   debug('TYPO3 4.0 required!');
> }
> 
> 
> 
> Regards,
> 
> Christian

Ok. I might use it in some other case. I needed version info as a global 
variable in several places for many functions and I can't set 
stand-alone if-statement inside a class.

This works outside class as a global variable even if it is not very smart

if(intval(substr($GLOBALS['TYPO_VERSION'],0,1)>3))
	$Typo4=1;

it doesn't matter, if some Typo3 version doesn't use that variable 
because the purpose is return true only if typo3 version is bigger than 3x




More information about the TYPO3-dev mailing list