Learn about DokuWiki
Learn about DokuWiki
This is an old revision of the document!
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Similar to phpinc
This plugin will run a specified php function from a set of php functions configured for use with this plugin.
External requirements: None
A sample function is included called /functions/helloWorld.php. To use add the following plugin syntax to a wiki page. No configuration changes are needed to run the sample.
The example passes 4 parameters to the invoked function.
Parameters are passed as strings. The example shows how the invoked function typecasts the last parameter to be used as an integer.
Parameters are not required. The simplest usage is to invoke a function with no parameters.
Use of <function=name> is all that is required. If your function requires parameters these can be supplied by using a “?” after the function name and providing the parameters as id=value. Parameters are separated by a “&” symbol.
An example would be useful. What is this plugin for? What can you do with it? What's the advantage of calling a named php function? Is this just a different way to make a syntax plug-in, for people who know php but don't want to learn the dokuwiki syntax? – Zioth
I often want to run php to query a database and output the result. These queries sometimes involve other functionality that would not be handled by the generic database plugins available. I would not want to write a plugin for each type of query I run. Also for security reasons I am reluctant to allow php to be executed on a wiki page. The phpinc plugin was close to providing this functionality but it appears to have some security issues and states that it is no longer supported. With this function plugin I can easily and I believe securely connect a php function to run on a wiki page. If the php functions are general in functionality they could be documented on the wiki for use by the users.
I provided a simplified example as the function I am running involves interfacing with a database with specific tables. If I create a function better suited as an example I will provide it. Best regards – tom_c