Two versions of comp 2.5 / 3.0 in the same zip file?

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
User avatar
Presto-X
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 241
Joined: Fri Apr 06, 2007 12:23 am
Location: Boise, ID
Contact:

Two versions of comp 2.5 / 3.0 in the same zip file?

Post by Presto-X » Mon Jan 21, 2013 8:37 am

Hey guys,

I would like to find out if this is possible and if so how are you guys doing it? I am working on two separate versions of the same component one for Joomla 2.5 and the other for 3.0, I would like to have one package zip file that the users can install and detect what version of Joomla they are running and install the appropriate version. I thought creating a package with two zip files with the manifest.xml files versions set to the correct versions would work, but it does not, the 2.5 version installs in to the 3.0 site, not what I want lol… am I doing this ass backwards? What do you guys suggest the best plan of attack is?

I have seen other developers to add extension_name_UNZIP_FIRST.zip to their files so their users know to unzip and upload the correct version, but it would be nice if new less computer savvy users did not have to this.

I can foresee others asking this same thing as more developers start rolling out 3.0 extensions, this is a good time to start the conversation about it :O)

 
User avatar
MaxLynam
Joomla! Intern
Joomla! Intern
Posts: 77
Joined: Wed Jan 19, 2011 4:59 am
Location: Olinda, Victoria, Australia
Contact:

Re: Two versions of comp 2.5 / 3.0 in the same zip file?

Post by MaxLynam » Thu Feb 07, 2013 6:32 am

Hey Presto - simple answer is YES .... sure you can.

The preferred method is to have a look-up to checkl the installed versino and load the "modified parts" relevant to the version. Much of 2.5.x to 3.x difs are not TOO huge ...... but it "may" be easier to do as you noted others have done, but depends on your what the com/plg/mod is/does.

eg.

Code: Select all

if(version_compare(JVERSION, '3.0', 'ge'))
{
   JHtmlBehavior::framework();
}
else
{
   JHtml::core();
}
or

Code: Select all

if (method_exists('JHtml','core')) 
JHtml::core(); 
else 
JHtmlBehavior::framework();
Check these docs for everything you may want to review:
http://docs.joomla.org/Potential_backwa ... 12.1#JHtml
http://docs.joomla.org/Component_Develo ... ading_list
-- not 3.0, but has some sample code for you to use:
http://docs.joomla.org/Making_single_in ... 2.5_series

Of course, get someone elses extension that only has one install file and reverse engineer how they did it ... always works well.

Hope that helps.
Max Lynam @MaxOnTheHill | Olinda, Melbourne, Australia | Joomla since 2005
Digital Marketing Consultant & Bootstrapped Website Builder - sitedev since 1993
{ http://www.maxlynam.com } { http://www.molehill.com.au }

 

Locked

Return to “Extensions for Joomla! 3.x”