XML installation files for modules
Elxis installers use XML files to get information about what an extension is for and what files the installation package contains. These XML files are also used to provide you customization parameters on the way the extension works (XML parameters). In this guide we will show you how you should format XML installation files for Elxis modules. Other extension types (components, templates, etc) have slightly different XML files. This guide is for Elxis 2008.x generation.
Lets rock!
All XML files by default suppose that the file encoding is utf-8. It is no a bad idea to make this clear on the headers of our file. Notice that the encoding of the XML file itself may also be UTF-8 (or iso-8859-1) especially if you wish to write non latin1 characters (for example in the module description).
<?xml version="1.0" encoding="utf-8"?>
Now we are going to tell Elxis what this installation package is for by setting the proper type. Valid types are: module, component, mambot, bridge, tool, language, and template. In this guide we will use the "module" type. Some types have a "sub-type" attribute called client. Module is one of them. The client attribute in a module declares if it is a front-end module or an administration module. For modules the client attribute should only be declared if the module is for Elxis CMS back-end! Otherwise set the client value to empty or dont set client at all! If the module is for Elxis back-end you should use client="administrator". In the same line we should declare the global version of Elxis CMS this extension is for (elxis generation). Attention: This is not the version of your extension! It is the Elxis CMS generation the extension was built for. Elxis 2008.0+ during installation detects this version and notifies you if the installation package is for a previous Elxis version than yours or it is wrong (i.e. for an other CMS).
<mosinstall type="module" version="2008">
XML headers
We are ready to write down some general information about our module.
name: The name of our extension
author: Who created this extension (name or company)
licence: Licensed under this extension is released (GNU/GPL, GNU/LGPL, CC, Commercial, etc)
copyright (optional): The extension copyright message. Example: (C) 2006-2008 Elxis.org. All rights reserved
creationDate: The exact date the extension was created. You should follow this format: YYYY-mm-dd HH:ii:ss (Year-month-day Hour:Minute:Second). Elxis automatically converts this date to a human understandable date (multi-lingual), so it is important to keep the right format! Example: 2008-01-14 19:45:23.
authorEmail: The e-mail address of the author
authorUrl: URL address to the author web site
cxlangdir (optional): The relative path to the custom language directory if you wish to use custom language strings in XML parameters beyond the standard. Example: /modules/mod_mysupermodule/language
version: The version of the extension (not Elxis version!). We advise you to start from 0.1 for beta versions and 1.0 for stable versions.
description: A short description for your extension. If you wish you can use CX_ constants from your custom language files or CDATA to write HTML.
Let's see what we have done till now:
<name>My super module</name>
<author>Elxis Team</author>
<licence>GNU/GPL</licence>
<copyright>(C) 2006-2008 Elxis.org. All rights reserved</copyright>
<creationDate>2008-01-18 20:36:15</creationDate>
<authorEmail>username@mysite.com</authorEmail>
<authorUrl>http://www.elxis.org</authorUrl>
<cxlangdir>/modules/mod_mysupermodule/language</cxlangdir>
<version>1.0</version>
<description>This Super Module converts your site to a time machine!</description>
Module files
Ok, let's list now the files that consist our installation package. The files should be listed by providing their relative path. As base directory should be consider the directory that corresponds to our extension type (i.e. /modules for front-end modules). The main module file is declared with the attribute module having as value the module filename without the extension php. For security use empty index.html files in your sub-directories.
<files>
<filename module="mod_mysupermodule">mod_mysupermodule.php</filename>
<filename>file_in_modules_root_dir.php</filename>
<filename>mod_mysupermodule/index,html</filename>
<filename>mod_mysupermodule/readme.txt</filename>
<filename>mod_mysupermodule/superjavascript.js</filename>
<filename>mod_mysupermodule/language/index.html</filename>
<filename>mod_mysupermodule/language/english.php</filename>
<filename>mod_mysupermodule/language/greek.php</filename>
</files>
Module parameters
First of all, if our module does not have any parameters (almost all modules have parameters) we write a single "<params />" to our XML file. Each parameter has the following attributes:
name: The name of the parameter. No spaces are allowed. Example: moduleclass_sfx
type: The type of the html element will be used to render this parameter. Valid types are: text, list, radio, textarea, mos_section, mos_category, mos_menu, imagelist and spacer.
label: The label of the parameter (multi-lingual).
description (optional): Displays a help message for the proper completion of the parameter (multi-lingual)
dir (optional): Text direction. Can be set to ltr (left-to-right) or rtl (right-to-left). By default everything is ltr except if is set differently and only if an RTL language is currently in use. Tip: Some XML parameters, like e-mail addresses, should always be LTR, so set dir="ltr" to them in order to be always LTR even for RTL languages.
default: The default value of the parameter.
Examples:
<params>
<!--A text parameter using standard XML language (AX_) -->
<param name="moduleclass_sfx" type="text" dir="ltr" default="" label="AX_SM_MCSL" description="AX_SM_MCSD" />
<!--A list parameter using custom XML language (CX_) and RTL -->
<param name="cust_name" type="list" dir="rtl" default="2" label="CX_PPD_TIMDON" description="CX_PPD_TIMDOND">
<option value="0">CX_XXX_LS1</option>
<option value="1">CX_XXX_LS2</option>
<option value="2">CX_XXX_LS3</option>
</param>
<!--A radio parameter -->
<param name="cur_select" type="radio" default="0" label="Display welcome message?" description="">
<option value="0">AX_NO</option>
<option value="1">AX_YES</option>
</param>
<!--A textarea parameter, notice the cols and rows attributes -->
<param name="wecome_msg" type="textarea" dir="rtl" default="" label="AX_TTT_LEB" description="CX_YYY_DESC" cols="30" rows="5" />
<!--A spacer parameter, bold text or horizontal ruler -->
<param name="@spacer" type="spacer" default="Bold message" label="" description="" />
<!--A, imagelist parameter, notice the relative images directory -->
<param name="image1" type="imagelist" dir="ltr" directory="/images/M_images" default="" label="Select image" description="" />
</params>
Wrapping everything up
Dont forget to close the "mosinstall" tag we opened at the begining. Our module XML installation file is ready!
</mosinstall>



