Important

Major updates are in progress. Some pages and languages may not be available.

Writing Plugins

Plugins are the way to extend Tiki's wiki functionality to do anything (and everything) that you want. Although Tiki includes over 100 plugins, you may find it necessary to create your own plugin that meets your specific needs. This section will show you how.
{NOTE()}This section is not a guide to PHP programming. For details on PHP, see http://www.php.net.{NOTE}


{TIP()}If you are new to Tiki, start with Using Plugins in Tiki for Dummies Smarties. For complete information on Tiki plugins, refer to the Tiki Documentation Tiki .{TIP}

When to Use a Plugin

Basically, you should use a plugin to accomplish anything that you cannot normally do with regular Tiki wiki syntax. This could be something as simple as changing the font or color of text, or a complex as performing datbase queries and returning SQL values.

You could, of course, use existing plugins (such as the HTML or JS plugins) and then include the specific code or script. While this method will definitely work (and may even be easier initially) it is not very "futureproof." If you ever want to change or update the script, you will have to manually make the change every place that you added it. Whereas with a plugin, you simply update the plugin once. Tiki will automatically update the code on every page that uses the plugin.

In other cases, a plugin is simply needed if you want to vary the output, depending on the contents of the database.
{NOTE()}See Adding Widgets and Scripts for additional examples of plugins.{NOTE}

Writing a Simple Plugin

{PULLQUOTE(float=right, width="300", color="00B7B7")}This is an example of a pull quote.{PULLQUOTE}Let's write a simple plugin that will allow you to create a pull quote1 on a wiki page, as shown on the right side of this page.

We'll want users to be able to define:

  • Where the pull quote appears (on the left or right side of the page)
  • The width (in pixels)
  • The color of the text


Create a new, empty PHP file named wikiplugin_pullquote.php.
{NOTE()}Wiki plugins should be named using the convention wikiplugin_NAME_OF_THE_PLUGIN.php.{NOTE}
There are three basic steps to creating a plugin:

1 A pull quote (also known as a lift-out quote or a call-out) is a quotation or edited excerpt typically placed in a larger typeface on the same page. http://en.wikipedia.org/wiki/Pull_quote

Advertising