Revision [14804]

This is an old revision of ActionInfo made by DarTar on 2006-07-13 03:27:38.

 

WikkaDocumentation Wikka Documentation

How actions work and why it is easy to write your own


See also
UsingActions Using actions in Wikka pages
This Page is also avaible in ActionInfoDE German

Technically, actions are nothing else then normal php-files, which are included through the wikka-engine:

As you know from UsingActions Using actions in Wikka pages, you simply put the name of an action (and parameters if necessary) between {{ and }}. The wikka-formatter then sends the text between the two brackets to the function Action($action, $forceLinkTracking = 0) in the wikka.php . If you take a closer look at it, you will see that everything after the first word is treated as a parameter of the action. If the action-file is found, the parameters are given to it in form of an array.

You can easily extend wikkas functionality by writing your own actions and saving them under a name in the actions directory. This page intends to give you some help with it.


1. Planning

At first, you should think about what you want to do and if an action is the best choice for it.

Action vs. Handler
Mostly you will have to choose between action and handler. You can easily seperate them with the following question:
Do you add something to a page, or do you want to do something with the page?

  1. for an addition to a page (the google-form, a weather-forecast, a table), an action should be your choise
  1. for doing something to a page (like cloning, deleting, editing...), use a handler

Let others do your work... ;-)
Since there are many people working with php, it is highly possible that someone has already written the code you need. You surely have looked at the (offical) WikkaFeatures and the Development-Category, but have you also seen the (unoffical) CodeContributions and the UserContributions-category?

It may take you some time to search all this places, but it is better than doing the same work twice.

... or at least help you
When you have started working on your action, announce this at PluginsInDevelopment, perhaps someone else wants to help you working on it.


2.Security

You should always keep in mind that every user, who has write-access to your pages, can use an action by default. That means if you want your action beeing limited to admins or registered users, you have to take care of it in the action itself, because wikka won't!

code for restricting access

Parameters
As said above, paramters are given as an array to the action. You can use the following code to get their values:

code for getting params

will be continued

CategoryDocumentation
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki