Home Features Demos Download Installation User Manual Developer Manual Relation function Credits

Login

inc/function.php

Defines the class for the functions

Objets

swFunction

info() returns a helpline on the function an its arguments
dowork($args) calculates the result. $args is an array without keys given by the template parser. As the user writes directly the arguments as template, the function should not assume all arguments are present but check the number of arguments. Each argument is a string.

Functions should not have side effects, but be self-sufficient. Functions do not know the context they are in. Sofawiki-supplied functions are in the inc/functions folder.
User supplied functions are in the site/functions folder and must be included in the configuration.php file.

Conventions:

  • Each file in the functions folder contains one function class.
  • The functions are named lowercase alphanumeric, starting with an alpha and no space.
  • The filename is the function name.
  • Each file contains the class definition and adds the function to the $swFunctions global array using the function name as key.

File structure inc folder