Calling a php function :
In that case, the function has to fullfill some simple conditions :
-it should be in a included php file (see bz:page) or defined in the file itself.
-it should take a hash table as its solo argument : the format being name =>
value.
-in case it has a return value, it should as well be a hash table, so that
several values can be returned.
Once the function has returned, the returned values are set as global variables
until the end of the script.
The format for the call is
{ bz:run function="name_of_the_function" arg1="value1"
... argn="valuen" }
Example :
<html>
<?php function test($d) {
$n=0;
foreach ($d as $name => $value) {
echo "$name => $value <br>";
$n++;
}
return Array("n" => $n);
}
<body>
<?php $value='hello' ?>
{ bz:run function="test" a="variable1" b="variable2"
c="$value" }
<br />
{ $n} arguments were provided.
</body>
</html>
|