identify Joomla3 to make extension for both 2.5 and 3.0?

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
User avatar
carsten888
Joomla! Ace
Joomla! Ace
Posts: 1224
Joined: Sat Feb 11, 2006 8:32 am
Contact:

identify Joomla3 to make extension for both 2.5 and 3.0?

Post by carsten888 » Tue Dec 18, 2012 1:09 pm

To make extensions for both Joomla 2.5 and Joomla 3.0 I'm looking for a unique identifier.

something like this

Code: Select all

if(!defined('DS')){
	//joomla 3
	define('DS',DIRECTORY_SEPARATOR);
}else{
       //joomla 2.5
}
but that would not work if another extension, for example a system-plugin, has defined DS (like seems to be the common fix these days).

Is there an adviced unique identifier for joomla 3?
http://www.pages-and-items.com my extensions:
User-Private-Page, Redirect-on-Login, Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, plugin load module in article, plugin pure css tooltip and more...

User avatar
Ratmil
Joomla! Explorer
Joomla! Explorer
Posts: 318
Joined: Sat Dec 06, 2008 7:07 pm

Re: identify Joomla3 to make extension for both 2.5 and 3.0?

Post by Ratmil » Tue Dec 18, 2012 3:56 pm

Code: Select all

$version = new JVersion;
if($version->RELEASE >= "3.0")
{
    //Joomla 3.0
}
else
{
    //Joomla 2.5
}

User avatar
carsten888
Joomla! Ace
Joomla! Ace
Posts: 1224
Joined: Sat Feb 11, 2006 8:32 am
Contact:

Re: identify Joomla3 to make extension for both 2.5 and 3.0?

Post by carsten888 » Fri Dec 28, 2012 7:55 am

thank you!
http://www.pages-and-items.com my extensions:
User-Private-Page, Redirect-on-Login, Admin-Help-Pages, Dynamic-Menu-Links, Admin-Menu-Manager, plugin load module in article, plugin pure css tooltip and more...


Locked

Return to “Joomla! 3.x Coding”