Support Joomla!

references:joomla.framework:jversion-iscompatible

isCompatible

API Package Class phpDocumentor Last reviewed Doc status
Joomla.Framework Joomla.Framework JVersion JVersion::isCompatible never Work in progress

Compares a “PHP standardized” version number against the current Joomla! version. This is useful if you would like to write extensions working only on some specific version of Joomla!

This method can be called statically.

Syntax

boolean isCompatible( string $minimum )

$minimum string A version string compliant with PHP‘s version_compare()

Examples

Find if the present Joomla! installation matches version “1.5.0”. Provided the constant JVERSION has a value of “1.5.0”.

Example

$version_required = '1.5.0';
if ( JVersion::isCompatible($version_required) !== true ) {
  echo "Please install Joomla! ". $version_required ." to use this code.";
} else {
  echo "Version requirements are set.";
}

might produce on success:

Result

Please install to Joomla! 1.5.0 to use this code.

Known limitations

The method is using PHP‘s Equal operatoreq” to compare the provided $minimum with JVERSION. If your code requires a specific version of Joomla! to be available, i.e. “1.5.0”, this method will perform as expected. If your code will perform as well with a (hypothetical) release “1.5.1” or “1.6.5”, the method will return false however. Use the native version_compare() function if you need a more sophisticated version comparision.


Discussion

Full name:
E-Mail:
 
references/joomla.framework/jversion-iscompatible.txt (670 views) · Last modified: 2007/09/22 02:45