
Joomla 1.6 was officially released several days ago. There are many great improvements and functionality that every designer, web developer, web master or administrators will appreciate. But I will write about them in my next posts.
With the advent of the new version comes a time when you need to rewrite your applications to be able to work with it.
This article describes how to collect several types of Joomla! extension (component, module and plugin) in one package. You will learn how to install them all at once.
The first thing you should do is to save plugins and modules in separate directories. Now, put the XML code that follows in the manifest file of your component. After that, set the information (path, name, group) about your extensions.
<module folder="modules" module="mod_helloworld" name="Hello World Module" />
</modules>
<plugins>
<plugin folder="plugins/system" plugin="helloworld" name="System - Hello World" group="system" />
</plugins>
It is the time when you should enter the code that follows in the installation script. Put it in the method "install". With this code, you get the location of your extensions. Then create an object JInstaller and specify the location of your plugins and modules. At the end all plugins are activated by setting a value to 1 for field "enabled".
$parent = $parent->getParent();
$source = $parent->getPath("source");
$installer = new JInstaller();
// Install plugins
foreach($manifest->plugins->plugin as $plugin) {
$attributes = $plugin->attributes();
$plg = $source . DS . $attributes['folder'].DS.$attributes['plugin'];
$installer->install($plg);
}
// Install modules
foreach($manifest->modules->module as $module) {
$attributes = $module->attributes();
$mod = $source . DS . $attributes['folder'].DS.$attributes['module'];
$installer->install($mod);
}
$db = JFactory::getDbo();
$tableExtensions = $db->nameQuote("#__extensions");
$columnElement = $db->nameQuote("element");
$columnType = $db->nameQuote("type");
$columnEnabled = $db->nameQuote("enabled");
// Enable plugins
$db->setQuery(
"UPDATE
$tableExtensions
SET
$columnEnabled=1
WHERE
$columnElement='helloworld'
AND
$columnType='plugin'"
);
$db->query();
Now pack all extensions in an archive and ready.
You are able to download an example and the source code from the link below.
If you have questions or need help, leave a comment or contact me by contact form. We will gladly assist you.


