Working with XML parameters
The elxisParameters class allows you to create HTML form elements of many different types by declaring these elements in an XML file. Elxis will parse this file and automatically generate the HTML output. Additionally elxisParameters may also handle the values of a raw parameters string stored in database or else.
You can parse an elxis extension's installation XML file (for example content.xml) or a custom XML file (for example content.category.xml). In case of parsing an exntesion installation file the XML file should follow the elxis guidelines for such a file. The general format of this file is as shown below.
<package type="component"> <params> ... </params> </package>
In case of parsing a custom XML file the general format is shown below (the component attribute is optional.).
<elxisparameters type="component" component="com_xxx"> <params> ... </params> </elxisparameters>
Parameters can be split into groups. It is a good practice to group similar parameters to groups. A group starts with the <params> tag and ends with a </params> tag. In the final HTML output Elxis will generate a table for each parameters group.
Each params group can have the following optional attributes.
Imporant: The value of groupid must be unique and greater than 999!
<params group="Layout" groupid="1001" collapsed="0"> <param /> <param /> </params> <params group="Advanced settings" groupid="1002" collapsed="1"> <param /> <param /> </params>
If you want to trigger the visibility of a parameters group from an other element then you need to set a groupid for that group. You can do so by using the groupid attribute. On the example below parameter showgroup options triggers the visibility of the parameter's group with groupid 1000.
<params> <param type="radio" name="showgroup" default="0" label="SHOW" description=""> <option value="0" hide="1000">HIDE</option> <option value="1" show="1000">SHOW</option> </param> </params> <params groupid="1000" collapsed="1"> <param /> <param /> </params>
Elxis supports a number of XML parameter types. By using the correct parameter type each time you make the administrator's life easier.
Generates an input text box.
<param type="text" name="myaddress" default="" label="Address" description="" />
The multi-language instances for a parameter get saved using the following format: {name}_ml{language}
So if name = "myaddress" the instance for the French (fr) language will be saved as myaddress_mlfr
If the element has both dir="rtl" and multilingual="1" then the text direction will switch automatically to rtl for RTL languages and to ltr for the LTR ones.
Generates a drop down select box.
<param type="list" name="country" default="FR" label="COUNTRY" dir="rtl" description=""> <option value="FR" show="1001" hide="1002,1003">FRANCE</option> <option value="DE" show="1002" hide="1001,1003">GERMANY</option> <option value="GR" show="1003" hide="1001,1002">GREECE</option> </param>
Optional attributes for select options:
Generates a drop down select box with the ability to display a preview image for each option.
<param type="previewlist" name="myweather" default="" label="Weather" dir="rtl" position="right" width="68" height="68" description=""> <option value="">SELECT</option> <option value="clear" image="components/com_weather/images/weather-clear.png">Sunny day</option> <option value="few-clouds" image="components/com_weather/images/weather-few-clouds.png">Few clouds</option> <option value="clouds" image="components/com_weather/images/weather-clouds.png">Clouds</option> <option value="showers" image="components/com_weather/images/weather-showers.png">Showers</option> <option value="storm" image="components/com_weather/images/weather-storm.png">Storm</option> <option value="snow" image="components/com_weather/images/weather-snow.png">Snow</option> </param>
Additional param attributes:
Additional option attributes:
Generates a drop down select box having options the folder names inside a given directory. The given directory should be the relative path from elxis root.
<param type="folderlist" name="lang" default="" label="Language" directory="language/" description="Select language" />
The directory attribute supports the multisite keyword. You can provide such a keyword to distinguise the directory path based on the current multisite. Note that the keyword will only be triggered on subsites (ELXIS_MULTISITE > 1). Supported keywords: {multisite}, {multisite/}, {/multisite} and {/multisite/}. Note the optional slashes surrounding the multisite keyword.
<param type="folderlist" name="img_folder" default="" label="Images folder" directory="media/images/{multisite/}" description="Select folder" />
In the above example the directory will become:
media/images/ if multisites are disabled or if we are on the mother site
media/images/site2/ if multisites are enabled and we are on sub-site with id 2
media/images/site3/ if multisites are enabled and we are on sub-site with id 3
etc...
Generates a drop down select box having options the existing images inside a given directory. The given directory should be the relative path from elxis root. You can optionally display a preview of the images if the position attribute is set.
<param type="imagelist" name="img" default="" label="Image" directory="media/images/" description="" />
If the optional attribute position is set then a preview of the image is also being displayed.
Optional param attributes:
<param type="imagelist" name="img" default="" label="Image" position="bottom" width="100" height="80" directory="media/images/" description="" />
Parameter type imagelist support the multisite keyword for the directory attribute. See folderlist for more.
Generates a group of radio boxes. Optionally it can toggle visibility of other parameter groups (attributes show and hide).
<param type="radio" name="cache" default="1" label="CACHE" description="ENABLE_CACHE_D"> <option value="0" show="1000" hide="1001">NO</option> <option value="1" show="1001" hide="1000">YES</option> </param> <params groupid="1000" collapsed="1"> ... </params> <params groupid="1001" collapsed="0"> ... </params>
Generates a textarea box. Optional attributes: cols, rows and dir.
<param type="textarea" name="txt" default="" cols="30" rows="5" dir="rtl" label="Comments" description="" />
Generates a category selection drop down list. Optional attributes: dir.
<param type="category" name="mycat" default="" dir="rtl" label="Category" description="Select category" />
Generates a country selection drop down list.
<param type="country" name="mycountry" default="" label="Country" description="" />
Generates an integer select drop down box. The start and end points are set by the first and last attributes and step sets the increasing or decreasing step between the options values.
<param type="range" name="pickyear" first="2010" last="2030" step="1" default="2012" label="Year" description="" />
If, for example, first=4, last=12 and step=2 the following options will be generated: 4, 6, 8, 10, 12
If the first option is greater than the last option then the range will be reversed meaning that the options values will be generated in descending order.
Example: first=10, last=-4, step = 2. Generated options: 10, 8, 6, 4, 2, 0, -2, -4
first and last can be negative or positive integrers. step must be always greater than 0. The default step value is 1.
Generates a month drop down select box.
<param type="month" name="pickmonth" default="0" short="0" label="Month" description="" />
Optional param attributes
If month value is less than 1 (0 for example) then the value is switched to the current month (1, ..., 12)
Generates a user group select box. For each option the group's access level (0, ..., 100) is also being displayed in the HTML output.
<param type="usergroup" name="pickgroup" default="0" label="User group" description="" />
Generates a user select box.
<param type="username" name="pickuser" default="0" label="User" realname="0" description="" />
Optional param attributes
This list will display up to 200 users ordered by their firstname or username.
Generates a hidden field.
<param type="hidden" name="pickhidden" autovalue="{TIMESTAMP}" default="" label="hidden" description="" />
The autovalue attribute can set the value of the element to any of the supported options bellow:
{UID} sets the value of the hidden element to the current user id.
{GID} sets the value of the hidden element to the current user group id.
{DATETIME} sets the value of the hidden element to the current datetime (YYYY-mm-dd HH:ii:ss).
{TIMESTAMP} sets the value of the hidden element to the current UNIX timestamp.
{LANGUAGE} sets the value of the hidden element to the current language identifier (en, el, it, de, etc...)
Displays a comment text. The text can be entered either in default attribute or inside the param tags. You can also use a language string or even CDATA and write HTML.
<param type="comment" name="members_com" default="SELFDISPMEMBLI" label="" description="" />
<param type="comment" name="members_com" default="" label="" description="">SELFDISPMEMBLI</param>
<param type="comment" name="members_com" default="" label="" description=""> <![CDATA[<span style="color:#ff9900;">hello!</span>]]> </param>
Generates a text field that can triggers a javascript colour picker (HEX values).
<param type="color" name="mycolour" default="" label="Colour" description="Pick colour" />
Generates a template position select box.
If the optional attribute none is set to 1 the option to select no position is also available.
If the optional attribute global is set to 1 the option to select a global setting is also available.
Note that the value of the global setting stored after selecting this option is always _global_.
<param type="position" name="mypos" default="left" none="0" global="0" label="Position" description="Select template position" />
Generates a menu collection position select box.
<param type="collection" name="mycol" default="mainmenu" label="Collection" description="Select menu collection" />
Generates a file upload box. The file will be uploaded to the specified path with the filename of the parameter name. If the upload path does not exist Elxis will create it automatically. You can not upload files in the Elxis root folder.
<param type="file" name="custom_image" path="modules/mod_opensearch/" filetype="png,jpg,jpeg,gif" maxsize="0" resizewidth="0" resizeheight="0" default="" label="CUSTOM_IMAGE" description="CUSTOM_IMAGE_DESC" />
Elxis allows the upload of the following file types: png, jpg, jpeg, gif, ico, svg, psd, mp3, ogg, avi, mpg, mpeg, wma, wmv, mkv, aac, mp4, flv, swf, doc, docx, pps, ppt, xlsx, xls, csv, odp, odf, ods, rtf, pdf, txt, xsl, xslt, css, xml, zip, rar, tar, gz, bzip2, gzip
Uploading files via parameters is only allowed in Elxis administration area and when the SECURITY_LEVEL configuration option is 0 (normal). If upload fails the parameter will keep its original value.
Parameter type file support the multisite keyword for the path attribute. See folderlist for more.
Develop engines to extend Elxis search to anything you can imagine