get Joomla version (function)

// OPTION A // get the Joomla! version (j25x, j3x) function getJVersion() { JLoader::import( "joomla.version" ); $version = new JVersion(); if (!version_compare( $version->RELEASE, "2.5", "<=")) : $html = "Joomla version: 3.x"; else: $html = "Joomla version is 2.5.x"; endif; return $html; } // OPTION B // print Joomla! version JLoader::import( "joomla.version" ); $version = new JVersion(); echo "The joomla version is ".$version->RELEASE; // Output: The joomla version is 3.3

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.