Codex comes bundled with a set of custom wiki plugins that can be used in any wiki page by following the following syntax:
<nowiki>{{{PluginName arg1="" arg2="" ...}}}</nowiki>
Basically, you create a tag with the name of the plugin to use and then just create arguments of name-value pairs of whatever arguments the plugin's renderit() method takes in.
Creating wiki plugins are very easy. Just drop them in the /App/plugins/wiki folder and you are ready to start using them in your wiki pages.
A wiki plugin is exactly just like any other ColdBox plugin. ColdBox Plugin Guide.
So if we have a plugin called DateTime, it's source code can look like this:
<cfcomponent name="DateTime" hint="A datetime wiki plugin" extends="coldbox.system.plugin" output="false" cache="true"> <-------------------------------------------- CONSTRUCTOR -------------------------------------------> <cffunction name="init" access="public" returntype="DateTime" output="false"> <cfargument name="controller" type="any" required="true"> <cfscript> super.Init(arguments.controller); setpluginName("DateTime"); setpluginVersion("1.0"); setpluginDescription("A date time wiki plugin"); //My own Constructor code here //Return instance return this; </cfscript> </cffunction> <-------------------------------------------- PUBLIC -------------------------------------------> <--- today ---> <cffunction name="renderit" output="false" access="public" returntype="string" hint="print today"> <cfargument name="format" type="string" required="true" default="full" hint="Full,Short, Medium"/> <cfreturn dateformat(now(),arguments.format)> </cffunction> <-------------------------------------------- PRIVATE -------------------------------------------> </cfcomponent>
And we can use it in our wiki pages like so:
//Initial space is left so wiki doesn't match and you can see the source <nowiki>{{{ Messagebox message="Hello World!"}}}</nowiki>
That's it. Welcome to the world of Codex Wiki Plugins. Now go out and start coding your very own plugins. Below you can see a plugin at work:
Below is a listing of all installed plugins that can be found in the following directory: C:\Inetpub\vhosts\codexwiki.org\httpdocs\plugins/wiki
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| movie | string | true | The movie path | |
| name | string | false | The name of the movie | |
| id | string | false | The default id for the movie | |
| align | string | false | left | left,center,right |
| width | string | false | 100% | Width of the movie |
| height | string | false | 100% | Width of the movie |
| quality | string | false | best | The video quality |
| bgColor | string | false | A background color | |
| wmode | string | false | transparent | The wmode of the movie |
| allowFullScreen | boolean | false | true | Allow full screen |
| allowScriptAccess | string | false | sameDomain | The allow script access arguemnt |
| scale | string | false | showAll | The scale of the movie |
| data | string | false | A data string to add to the object element | |
| FlashVars | string | false | A flashvars string to add to the object element |
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| page | string | true | The page name to render content | |
| args | string | true | The name-value pairs for token replacements, please add the values in single quotes. Ex: name='luis',age='20'. The name will be replaced in the template by looking at {{{[name]}}} and {{{[age]}}} token. |
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| message | string | true | The message to display | |
| type | string | true | info | The type of messagebox: info, error, warning |
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| pageName | string | true | The page name to redirect to |
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| format | string | true | full | The revision information type to render: full, medium, short, timestamp-full or timestamp, timestamp-medium, timestamp-short, useronly |
| content | codex.model.wiki.Content | true | This argument is passed automatically by codex, DO NOT PASS THIS. |
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| format | string | true | full | Full,Short, Medium |
| noTime | boolean | false | false | Flag to print also the time or not |
| Argument | Type | Required | Default Value | Hint |
|---|---|---|---|---|
| title | string | true | Installed Plugins | A default title for the h2 |