Component XML package descriptor

This is an example of a valid component entry in an XML package descriptor:

<?xml version="1.0" encoding="utf-8" ?>
<dkinstall version="0.2">
<components>
<component>
<id>com_dummy</id>
<name>Dummy</name>
<creationDate>2007/07/12</creationDate>
<author>legolas558</author>
<copyright>Copyright (c) 2006-2007 by legolas558 - Licensed under GNU/GPL</copyright>
<authorEmail>legolas558@users.sourceforge.net</authorEmail>
<authorUrl>http://drakecms.sourceforge.net/</authorUrl>
<version>0.1.0</version>
<description>Dummy component description goes here</description>
<files>
<filename>dummy.common.php</filename>
<filename>dummy.php</filename>
<filename>dummy.style.css</filename>
<filename>dummy.html.php</filename>
</files>
<params>
<param name="id" type="integer" default="0" label="_DUMMY_ID" />
</params>
<i18n>
<en>
<files>
<filename>components/dummy.php</filename>
</files>
</en>
</i18n>
<install>
<queries>
<query>
CREATE TABLE #__dummy (
id INT AUTO_INCREMENT,
field1 VARCHAR(100) NOT NULL DEFAULT '',
field2 INTEGER NOT NULL DEFAULT 0,
field3 TEXT
PRIMARY KEY (id)
)
</query>
</queries>
</install>
<uninstall>
<queries>
<query>DROP TABLE #__dummy</query>
</queries>
</uninstall>
<installfile>dummy.install.php</installfile>
<uninstallfile>dummy.uninstall.php</uninstallfile>
<administration>
<access>4</access>
<menu option="my_option">Dummy My Option</menu>
<i18n>
<en>
<files>
<filename>admin/components/dummy.php</filename>
</files>
</en>
<it>
<files>
<filename>admin/components/dummy.php</filename>
</files>
</it>
</i18n>
<files>
<filename>dummy.toolbar.php</filename>
<filename>admin.dummy.html.php</filename>
<filename>admin.dummy.php</filename>
</files>
</administration>
</component>
</components>
</dkinstall>

Each component-specific XML tag will now be explained in detail.

<files />

This XML block contains <filename /> tags which identify the frontend component files e.g. those files which will be copied into components/com_dummy/. These files must all exist and be in the same folder of the XML package descriptor.

<params />

This XML block contains <param /> tags which define the component parameters.

<param name="id" type="integer" default="0" label="_DUMMY_ID" />

name attribute

Specifies the unique identifier for the parameter.

type attribute

Specifies the type of data contained in the parameter; such information is used when customizing the component parameters. Valid type values are the following:

default attribute

Default value, can be omitted but if specified must be consistent with the type specification.

label attribute

Specifies the admin-side component language resource identifier to be used when showing the component parameter edit field.

<i18n />

This XML block contains sub-blocks for each language country code (2 letters) which is supported; each two letters sub-block (e.g. <en />) contains a <files /> sub-block. These files are copied into lang/xx/ where xx is the 2-letters lowercase country code.

<install />

The install XML block contains entries to be processed during the installation.

<queries />

Each <query /> must be a single SQL statement and will be processed during installation of the component.

<uninstall />

Same as <install />, but will be processed upon uninstall.

<installfile />

Relative path of PHP install file which will be included during installation. The install file must return 1/true if everything was successful, 0/false otherwise.

<uninstallfile />

Same as <installfile />, but included after uninstall.

<administration />

The administration XML block contains data relative to the backend side of the component; if this block is not present, no backend menu items will be associated. The backend component folder (admin/components/com_dummy) will anyway be created to host the package XML descriptor and the uninstall file (if present).

<access />

The access element specifies the admin access level for this component; it should be greater or equal to 3.