Two years ago I wrote about combining Joomla 1.0 and 1.5 extensions into a single installation package. This allowed developers to distribute only a single installation file of their extension which could be used on both Joomla versions. In the same time it was easier for users as well since they avoided dealing with different installation files for different Joomla versions.
Now we reveal how you can add a version for Joomla 1.6 or 1.7 to the same package and create a single installation file of your extension for all Joomla versions!
As described in the previous post, the trick for creating “hybrid” installations was to take advantage of differences in Joomla 1.0 and 1.5 installers. Using a special directory structure within our extension package we would serve the appropriate manifest file to the right Joomla version. Namely, the Joomla 1.0 installer will use the manifest file found on root, while the Joomla 1.5 installer will take the first XML manifest file it founds, which can reside in a folder called “1.5″. This way we could separate the installation files for different Joomla versions while still using a single installation package.
So how can we now add files for Joomla 1.7 and create a single extension installation package accepted by all Joomla versions: 1.0, 1.5 and 1.7? Well, we will use the same trick again: the difference in how installers handle the installation files. Let’s package our extension as follows:
The only difference now is that the files for Joomla 1.5 are located in a folder called “_1.5″ while the manifest and files for Joomla 1.7 are located in “1.6″.
The 1.7 installer will look at the “1.6/mod_example2.xml” while 1.5 will first find ”_1.5/mod_example2.xml”. As before, 1.0 installer will use the manifest residing on the root.
Again, the files for Joomla 1.0, 1.5 and 1.7 are nicely separated in different folders and zipped together in a single package that installs on all Joomla versions.
Finally, I attach the example module which you can test installing directly on all versions of Joomla.
The example used here is a module but the same method can be analogously applied to components, plugins, or anything that uses the Joomla installer.
EDIT: The post above also applies to Joomla 1.6
EDIT 2: Another useful post on creating hybrid Joomla extensions in a single package can be found here.