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

<HR>
Creative Commons
This guide is written by Rick Sapir and published by tikiforsmarties.com. This guide is Copyright © 2010-2014 by Rick Sapir under a Creative Commons Attribution-Share Alike 3.0 License. Some rights reserved.


Fair attribution includes a return link to http://twessentials.tikiforsmarties.com (for online use) and mention of primary author (Rick Sapir) and publisher (KeyContent.org).

Essentially, you are are free:

Share
to Share — to copy, distribute and transmit the work
Image
to Remix — to adapt the work


Under the following conditions:

Image
Attribution. You must attribute the work to me, as the original licensor, but not in any way that suggests that I endorse you or your use of the work. Fair attribution includes a return link to http://twessentials.tikiforsmarties.com (for online use) and mention of primary author (Rick Sapir) and publisher (KeyContent.org).
Image
Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.


Please read http://creativecommons.org/licenses/by-sa/3.0/legalcode for the full license.

Please read Credits and Acknowledgments for full list of contributors to this project.

Images

The screen images are from Tiki Wiki CMS Groupware, from some versions between Version 6 up to Version 12, and are made available under the GNU Lesser General Public License, Version 2.1 (LGPL). Some pictures and images are from stock.xchng and are subject to the SXC Image License Agreement.

Trademarks

Tiki, Tiki Wiki CMS Groupware, and the Tiki logo are trademarks of the Tiki Software Community Association, used with permission. KeyContent.org and Tiki Essentials are unaffiliated with the Tiki Software Community Association.

Privacy

Please see Privacy Policy for information on how your personal information is treated when you access Tiki Essentials.