====== Plugins / Advanced Examples ======
Plugins can be much more complex, and can grow to include a large set of many different functions to accomplish various tasks. This article covers how to pass values to your plugin functions, control runtime order, and most importantly, modify data supplied by an anchor.
====== Passing values to a plugin function ======
Sometimes your plugin functions will accept certain parameters, so you will need a way to pass values to them. Plugins are free to run code outside of functions specifically for this reason, so you can do things like retrieve data from the database on runtime.
Here is an example:
====== Controlling runtime order ======
Some plugins need to be called before or after others, so there is an option to define the "hierarchy" of a plugin. Simply give an integer value, where 1 is run first. Default order is the order plugins are read into the system, which is defined by the file/folder order of your server (normally alphabetical).
====== Modifying data supplied by an anchor ======
Sometimes anchors are put into place in order to allow customization of data coming in or out of the system. This can be used to control everything from JavaScript objects, as in the slideshow display type, or the site title used in the
When modifying data, the plugin function must always return a value.
====== Defining anchors within a plugin ======
Plugins can create anchors for other plugins to hook into, greatly extending functionality. Defining an anchor is simple:
====== Defining anchors that modify data ======
Now, if one were to create a plugin that modified this title in some way, it would look like this:
' . $title . '';
}
?>
===== Passing multiple values =====
Anchors can also pass multiple values. To do so, supply an array instead of a single value.
$title, 'name' => $name) );
?>