2

I have created custom component and a route plugin for Joomla 1.5 to to provide SEO URLs for my component and also articles and categories which are not menu tied. Now I have to install my component and route plugin separately. Is there a way to install both in one package please?

Thank you in advance! Vojtech

Vojtech
  • 2,533
  • 9
  • 34
  • 65

2 Answers2

6

There is a easier method.

What is a package?

A package is a extension that is used to install multiple extensions in one go.

How do I create a package?

A package extension is created by zipping all zip files of the extensions together with a xml manifest file. For example if you have a package composed by:

  • component helloworld
  • module helloworld
  • library helloworld
  • system plugin helloworld
  • template helloworld

The package should have the following tree in your zipfile:

-- pkg_helloworld.xml
 -- packages <dir>
     |-- com_helloworld.zip
     |-- mod_helloworld.zip
     |-- lib_helloworld.zip
     |-- plg_sys_helloworld.zip
     |-- tpl_helloworld.zip

The pkg_helloworld.xml could have the following contents:

 <?xml version="1.0" encoding="UTF-8" ?>
 <extension type="package" version="1.6">
 <name>Hello World Package</name>
 <author>Hello World Package Team</author>
 <creationDate>May 2012</creationDate>
 <packagename>helloworld</packagename>
 <version>1.0.0</version>
 <url>http://www.yoururl.com/</url>
 <packager>Hello World Package Team</packager>
 <packagerurl>http://www.yoururl.com/</packagerurl>
 <description>Example package to combine multiple extensions</description>
 <update>http://www.updateurl.com/update</update>
 <files folder="packages">
   <file type="component" id="helloworld" >com_helloworld.zip</file>
   <file type="module" id="helloworld" client="site">mod_helloworld.zip</file>
   <file type="library" id="helloworld">lib_helloworld.zip</file>
   <file type="plugin" id="helloworld" group="system">plg_sys_helloworld.zip</file>
   <file type="template" id="helloworld" client="site">tpl_helloworld.zip</file>
 </files>
 </extension>
Techie
  • 44,706
  • 42
  • 157
  • 243
  • 3
    Packages are available since 1.6, whereas the question was tagged with Joomla 1.5, so future readers should note that they may not be able to install multiple components, plugins, modules, etc in one go using a single package if they are using Joomla 1.5. – Dzhuneyt Apr 05 '13 at 15:05
4

When any extension installed Joomla triggers an event 'com_yourcomponent_install()' to your install file, which you have mentioned in xml file.

write a function com_yourcomponent_install in which get the path of plugin folder and install it

$installer =  new JInstaller();
// Install the packages
$installer->install($pluginPath);

For example

  1. in you xml file install.mycomponent.php
  2. and in install.mycomponent.php there should be a function com_mycomponent_install()
  3. this function will contain the code as

    $installer = new JInstaller(); // Install the packages $installer->install($pluginPath);

Gaurav
  • 28,447
  • 8
  • 50
  • 80