Actions

J1.5

Difference between revisions of "Using the core parameter types"

From Joomla! Documentation

(Fix red link)
 
(20 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{inuse}}
+
Parameters are one way that data may be stored for a Joomla! Extension. Each parameter consists of two parts:
==Core XML Parameter Types==
+
* A simple text string of the form {NAME} = {VALUE}, in which the parameter value is recorded. The strings are usually concatenated into a single string with other parameter values and stored in a table field.
XML parameter types allow the user to modify or change certain parts of a template, plugin, module, or component without having to edit any code - as long as these parameters are implemented by the developer of the Joomla! extension.
+
* A form field in the Extension backend that allows a user to enter the parameter value, and which is defined by an XML <code><param></code> element.
  
===The XML File===
+
Joomla! defines 21 core parameter types, each of which gives a predefined behaviour and appearance in the back-end. This makes it very easy for developers to implement a range of form data entry types (text boxes, radio buttons, calendar selectors and so on) with a minimum of effort. This behaviour and appearance is determined by the <code>type</code> attribute of the <code><param></code> element. See [[J1.5:Standard parameter types]] for a complete list and details of each type.
Within every Joomla! extension, there is an XML file used for installation purposes. This file lists all the contents of the package, as well as various items used in the Joomla! extension.
+
<noinclude>[[Category:Development]][[Category:Parameters]]</noinclude>
 
+
====Editing the XML File====
+
The XML file will have contents which look similar to this (except filled with the extension's details):
+
<pre>
+
<?xml version="1.0" encoding="utf-8"?>
+
<install type="module" version="1.5.0">
+
<name></name>
+
<author></author>
+
<creationDate></creationDate>
+
<copyright></copyright>
+
<license></license>
+
<authorEmail></authorEmail>
+
<authorUrl></authorUrl>
+
<version></version>
+
<description></description>
+
<files>
+
<filename module="mod_blog_calendar"></filename>
+
</files>
+
<languages>
+
                <language></language>
+
</languages>
+
<params>
+
</params>
+
</install>
+
</pre>
+
 
+
Find the <code><params></code> tag first. This will be the focus of XML parameters in Joomla!.
+
 
+
==Adding Parameters==
+
After finding the <code><params></code> tag, place an opening (<code><param></code>) and closing (<code></param></code>) tag for the parameter in the Joomla! extension's XML file.
+
 
+
After placing the opening and closing tags, choose whether you want one of the following types of parameters:
+
 
+
*List Parameters (parameters are changed in a drop down list)
+
*Radio Parameters (parameters are changed a check-box style input)
+
*Text Parameters (parameters are changed through direct text input)
+
 
+
===List Parameters===
+
List parameters are changed through a drop-down style list. List parameters are useful when there are multiple options or selections available to the end user of a Joomla! extension. To implement List parameters, use the following code in between the <code><params></code> and <code></params></code> tags in the Joomla! extension's XML file:
+
<pre>
+
<param name="Enter the name of the parameter here" type="list" default="Set the default value for the parameter here" label="Label the parameter here" description="Put a description of the parameter here">
+
</param>
+
</pre>
+
To add selectable items for the parameter list, use the following code in between the <code><param></code> tag and the <code></param></code> tag of the list parameter:
+
<pre>
+
<option value="Enter a string or integer here">Enter the title of the list item</option>
+
<option value="Enter a string or integer here">Enter the title of the list item</option>
+
</pre>
+
 
+
===Radio Parameters===
+
Radio parameters are changed through a check-box style selection mechanism. Place the following code in between the <code><params></code> and <code></params></code> tags in the Joomla! extension's XML file (make sure you replace the values with your own preferences):
+
<pre>
+
 
+
</pre>
+
===Text Parameters===
+

Latest revision as of 03:25, 11 June 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Parameters are one way that data may be stored for a Joomla! Extension. Each parameter consists of two parts:

  • A simple text string of the form {NAME} = {VALUE}, in which the parameter value is recorded. The strings are usually concatenated into a single string with other parameter values and stored in a table field.
  • A form field in the Extension backend that allows a user to enter the parameter value, and which is defined by an XML <param> element.

Joomla! defines 21 core parameter types, each of which gives a predefined behaviour and appearance in the back-end. This makes it very easy for developers to implement a range of form data entry types (text boxes, radio buttons, calendar selectors and so on) with a minimum of effort. This behaviour and appearance is determined by the type attribute of the <param> element. See J1.5:Standard parameter types for a complete list and details of each type.