Actions

J1.5

Difference between revisions of "Creating a search plugin"

From Joomla! Documentation

(New page: {{inuse}} ==Description== ==XML file== ==PHP file== ==Coding examples== ==Points to watch== ==Dependencies==)
 
Line 3: Line 3:
  
 
==XML file==
 
==XML file==
 +
The XML file is named the same as the PHP file, and is one of the two required files.
 +
Always start off with the XML tag and define that it is written in a UTF-8 format.
 +
<source lang="xml"><?xml version="1.0" encoding="utf-8"?></source>
 +
To define that the plugin has to be a search plugin, add this line:
 +
<source lang="xml"><install version="1.5" type="plugin" group="search"></source>
 +
The type will define it is a Plugin, the group defines the Plugin is in the group of Search Plugins.
 +
 +
After that, add some information about yourself and the Plugin, like this:
 +
<source lang="xml">
 +
<name>Name of your Search Plugin</name>
 +
<author>Your name</author>
 +
<creationDate>Created Date</creationDate>
 +
<copyright>Copyright</copyright>
 +
<license>License, for example GNU/GPL</license>
 +
<authorEmail>Your e-mail address</authorEmail>
 +
<authorUrl>Your website</authorUrl>
 +
<version>Version of the plugin</version>
 +
<description>Description of the Plugin; showed with installation and when editing the Plugin in the Plugin Manager</description></source>
 +
And now include your PHP file to the Search Plugin. The name of this file should be the same as the name of this XML file. Put this name also behind the plugin="" part.
 +
<source lang="xml">
 +
<files>
 +
  <filename plugin="nameofplugin">nameofplugin.php</filename>
 +
</files></source>
 +
Optionally, you could add some parameters to the Plugin. These will look like this:
 +
<source lang="xml">
 +
<params>
 +
  <param name="paramname" type="typeofparameter" default="defaultsetting" label="title" description="description"/>
 +
</params></source>
 +
*'''Param name:''' The name of the parameter. You will need this when creating the PHP file.
 +
*'''Param type:''' You could choose between several types of parameters. For example, "text" is used to display an input box.
 +
*'''Param default:''' The default setting for this parameter.
 +
*'''Param label:''' The name of this parameter displayed in the edit screen of this Plugin in the Plugin Manager.
 +
*'''Param description:''' The text which appears as a tool tip for this parameter.
 +
 +
And do not forget to end your XML file with the following tag:
 +
<source lang="xml"></install></source>
  
 
==PHP file==
 
==PHP file==
 +
 +
==INI file(s)==
  
 
==Coding examples==
 
==Coding examples==

Revision as of 11:47, 19 January 2008

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

Contents

Description

XML file

The XML file is named the same as the PHP file, and is one of the two required files. Always start off with the XML tag and define that it is written in a UTF-8 format.

<?xml version="1.0" encoding="utf-8"?>

To define that the plugin has to be a search plugin, add this line:

<install version="1.5" type="plugin" group="search">

The type will define it is a Plugin, the group defines the Plugin is in the group of Search Plugins.

After that, add some information about yourself and the Plugin, like this:

<name>Name of your Search Plugin</name>
<author>Your name</author>
<creationDate>Created Date</creationDate>
<copyright>Copyright</copyright>
<license>License, for example GNU/GPL</license>
<authorEmail>Your e-mail address</authorEmail>
<authorUrl>Your website</authorUrl>
<version>Version of the plugin</version>
<description>Description of the Plugin; showed with installation and when editing the Plugin in the Plugin Manager</description>

And now include your PHP file to the Search Plugin. The name of this file should be the same as the name of this XML file. Put this name also behind the plugin="" part.

<files>
   <filename plugin="nameofplugin">nameofplugin.php</filename>
</files>

Optionally, you could add some parameters to the Plugin. These will look like this:

<params>
   <param name="paramname" type="typeofparameter" default="defaultsetting" label="title" description="description"/>
</params>
  • Param name: The name of the parameter. You will need this when creating the PHP file.
  • Param type: You could choose between several types of parameters. For example, "text" is used to display an input box.
  • Param default: The default setting for this parameter.
  • Param label: The name of this parameter displayed in the edit screen of this Plugin in the Plugin Manager.
  • Param description: The text which appears as a tool tip for this parameter.

And do not forget to end your XML file with the following tag:

</install>

PHP file

INI file(s)

Coding examples

Points to watch

Dependencies