Creating custom template parameter types

From Joomla! Documentation

Revision as of 14:17, 19 January 2008 by Shantanubala (Talk | contribs)

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.
Quill icon.png
Page Actively Being Edited!

This j1.5 page is actively undergoing a major edit for a short while.
As a courtesy, please do not edit this page while this message is displayed. The user who added this notice will be listed in the page history. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page. If this page has not been edited for several hours, please remove this template, or replace it with {{underconstruction}} or {{incomplete}}.

Custom XML Parameter Type

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.

The XML File

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.

Editing the XML File

The XML file will have contents which look similar to this (except filled with the extension's details):

<?xml version="1.0" encoding="utf-8"?>
<install type="module" version="1.5.0">
                <filename module="mod_blog_calendar"></filename>

Find the <params> tag first. This will be the focus of XML parameters in Joomla!.

Adding Parameters

After finding the <params> tag, place an opening (<param>) and closing (</param>) 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 <params> and </params> tags in the Joomla! extension's XML file:

<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">

To add selectable items for the parameter list, use the following code in between the <param> tag and the </param> tag of the list parameter:

<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>

Radio Parameters

Radio parameters are changed through a check-box style selection mechanism. Place the following code in between the <params> and </params> tags in the Joomla! extension's XML file (make sure you replace the values with your own preferences):

Text Parameters