DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
plugin:function [2013-06-08 16:26] – discussion update tom_cplugin:function [2014-12-19 14:29] 2001:660:4701:2010:76d0:2bff:fe2a:8bbf
Line 6: Line 6:
 email      : tcafferty@glocalfocal.com  email      : tcafferty@glocalfocal.com 
 type       : syntax type       : syntax
-lastupdate : 2012-11-09 +lastupdate : 2013-06-08 
-compatible : Angua+compatible : Angua, Binky, Hrun
 depends    :  depends    : 
 conflicts  conflicts 
Line 29: Line 29:
 ===== Examples/Usage ===== ===== Examples/Usage =====
  
-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. +Two sample functions are included called ''/functions/helloWorld.php'' and ''/functions/anotherhelloWorld.php''. To use add the following plugin syntax to a wiki page. No configuration changes are needed to run the sample. 
-<code><function=file1?0=That's&1=All&2=Folks!&num=3></code> +<code> 
-The example passes 4 parameters to the invoked function. +<function=file2?0=That's&1=All&2=Folks!&num=3> 
 +<function=file3> 
 +<function=file2?0=That's&1=All&2=Folks!&num=3> 
 +</code> 
 +The example passes 4 parameters to the invoked function, invokes a different function with no parameters, and then calls the first function again
  
-Parameters are passed as strings. The example shows how the invoked function typecasts the last parameter to be used as an integer.+Parameters are passed as array elements. 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. Parameters are not required. The simplest usage is to invoke a function with no parameters.
 +
 +Examples can be seen at [[http://clean.glocalfocal.com/doku.php?id=start|Plugin Examples Site]]
 ===== Syntax ===== ===== Syntax =====
  
Line 47: Line 53:
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
  
-  - Add a file containing the php function into the /functions folder. The main function must be called 'run'.+  - Add a file containing the php function into the /functions folder. The main function must be called defined as 
 +      <code>$thisfunction = function($params) { 
 +                ..... 
 +            }; 
 +       </code>
   - 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.   - 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.
   - You can add a function description in /lang/../settings.php. This will show up in the admin configuration panel for the plugin.   - You can add a function description in /lang/../settings.php. This will show up in the admin configuration panel for the plugin.
Line 55: Line 65:
 === Change Log === === Change Log ===
  
-{{rss>http://github.com/feeds/TomCafferty/commits/plugin-function/master date}}+{{rss>https://github.com/TomCafferty/plugin-function/commits/master.atom date}}
  
 === Known Bugs and Issues === === Known Bugs and Issues ===
Line 131: Line 141:
 Millsdude, thanks for this update! It works real nice. I incorporated it into the release.  Millsdude, thanks for this update! It works real nice. I incorporated it into the release. 
 -- [[user>tom_c]] -- [[user>tom_c]]
 +
 +It may be worth noting that, although DokuWiki itself [[:requirements|requires only PHP version 5.2]], the function plugin seems to require a more recent version.  The plugin makes use of [[http://php.net/manual/en/functions.anonymous.php|anonymous function variable assignment]], a capability introduced in PHP version 5.3. -- [[user>areeves]]
plugin/function.txt · Last modified: 2018-05-31 00:16 by Klap-in

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