Respect my work! or BTC: 1MTFbBSKrocPK7G6GKfG8RoTw5N57WnnNa ![]() If you have paid donate send me e-mail with Your data or transaction number to receive an access code to articles with limited access. |
PmWiki /
Support plugins wirtten in PHPIn ProReports plugin PHP is a simple file format *.php, i.e. file with extension php and starting and ending characters respectively:
<?
function my_sum($a,$b)
{
return $a+$b;
}
?>
When you attach this plugin (how to do it look here) to reports system you can select it in Internal report (list Plugins) and therefore use function my_sum in part Expression/Code before Template or Expression/Code after Template each of element of the report. If you want to define a plugin function and operates on a predefined associative arrays $P, $V lub $F, it shall be defined as follows:
<?
function name_of_function(&$P,&$V,&$F)
{
//Sample activities
if ($P[name_of_parameter]==1)
{
.....
}
$V[name_of_variable]=12;
}
?>
Important!
Setting changes can be made only in an associative array $V and the nature of these changes is global, ie. after a change in an associative array $V specified variable set in the plugin value is valid until you change this value, either in another function in plugin or sections code elements of the report. Our simple sample plugin can be enriched by snippet/helper to make it easier to use it:
<?
function my_sum_select_exp_Helper()
{
$out=array(
"my_sum"=>"\\\$V[my_sum]=my_sum(\\\$a,\\\$b);\\r\\n"
);
return $out;
}
function my_sum($a,$b)
{
return $a+$b;
}
?>
This page may have a more recent version on pmwiki.org: PmWiki:PluginPHP, and a talk page: PmWiki:PluginPHP-Talk. |