How to determin what Joomla Version your component is running on

You ever needed to write extra code for a specific joomla version (for instance to check the password in joomla 1.0.13 you need to salt it)?

 

here is a quick tip:

 

use the global variable (defined by joomla ) $_VERSION

 

an example on using it:

 

function myBlabla()

 

{

 

global $_VERSION;
if($_VERSION->DEV_LEVEL>12){
$pwd = $row->password;

$salt = mosMakePassword(16);
$crypt = md5($row->password.$salt);
$row->password = $crypt.':'.$salt;

}else {
$pwd = $row->password;
$row->password = md5( $row->password );

}

 

}