Is there some method to get components version by it's name? I tried a lot of examples but didn't find any that would work. The thing like JComponentHelper::getParams('com_mycomponent')->get('version')
doesn't work as it retrieves values from jos_extensions.params
row. My components version is only in jos_extensions.manifest_cache
row...
You can use the following:
Joomla 2.5:
$parser = JFactory::getXMLParser('Simple');
$xml = JPATH_SITE .'/components/com_wrapper/wrapper.xml';
$parser->loadFile($xml);
$doc = $parser->document;
$element = $doc->getElementByPath('version');
$version = $element->data();
echo $version;
Joomla 3.x (Platform 13.3 and below)
$xml = JFactory::getXML(JPATH_SITE .'/components/com_wrapper/wrapper.xml');
$version = (string)$xml->version;
echo $version;
Joomla 3.2+:
getXML
was made deprecated as of 2 weeks after this answer. Instead, use SimpleXML
Obviously this is an example for the Wrapper component so change the paths to whatever suits your needs.
Hope this helps