DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:function

This is an old revision of the document!


function Plugin

Compatible with DokuWiki

Angua

plugin Run a php function from a set of configured functions

Last updated on
2012-11-09
Provides
Syntax
Repository
Source

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

Tagged with php

This plugin will run a specified php function from a set of php functions configured for use with this plugin.

Installation

:!: External requirements: None

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

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.

<function=file1>

Syntax

Basic syntax:

<function=name>
  • name — pick a name from the /conf/default.php file

Configuration and Settings

  1. Add a file containing the php function into the /functions folder. The main function must be called 'run'.
  2. Add a configuration parameter in /conf/default.php that contains a name to identify the function file and set it equal to the name of the file. No path information is required.
  3. You can add a function description in /lang/../settings.php. This will show up in the admin configuration panel for the plugin.

Development

Change Log

Known Bugs and Issues

None

ToDo/Wish List

None

FAQ

None

Discussion

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

plugin/function.1352605843.txt.gz · Last modified: 2012-11-11 04:50 by tom_c

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki