[pmwiki-users] PHP function question - php4 vs php5

Bob Sanders rsanders at sgi.com
Fri Nov 17 14:03:12 CST 2006


Hi,

We've been using something like a cookbook recipe in
pmwiki-1.0.2, but in the attempt to move to a current
pmwiki-2.2.x, it seems to be not executing the functions.

I used the debugging shown at - 

http://www.pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors

And the only print out I get is if - sms($_POST); is outside
the functions (there are only two).  No - sms("checkpoint 1");
actually print from within the function.

I know that normal recipes works - fortune works fine.  And I
can cause our code to error on the page, thus I know it's at
least being loaded.  But as I'm not much of any kind of
programmer, I've not found what the cause of this issue.

More detail - 

The code simply queries a bug database, using some parameters
from a text file in - htdocs.  (Moving that file out of the
way doesn't cause the print statement to show an error of no
file found.)

It then builds an array and prints out a few sequential tables
with the information onto the page.

The code used to sit in local/Main.HomePage  (And I tried it
there), but I moved it to cookbook/ as well as tried other
items.  Indeed when I mess up if give me an error it can't
find the code.

Here are the main def's in the code - 

function genQueryTable ($proj, $subm, $age)
{
// $proj from pvquery.txt with age attached after : for query using different
// age than the default $age from pvquery.txt (no : in $proj means using $age)
        sms("checkpoint 1");
        $a_array = explode(":", $proj);
    if ($a_array[1] != "") {
        $age = $a_array[1];
        $proj = $a_array[0];
    }
    echo "<br><font color = 'ff6600'> <B>Incidents submitted in last ";
    echo "<I>$age</I> days for project <I>$proj</I></font></B> <br>";


function genTestWeiPage()
{
// read file for query criteria, which specified projects, submitters, and
// age


And the end of the code - 

// For multiple projects, we use $p_array and then query each project for a
// table.  For multiple submitters, we prepare $sm to be used in bwxquery.
// Then call function genQueryTable. 
    if ($pj != "") {
        $p_array = explode(',', $pj);
        str_replace(",", "%2C", $sm);
        for ($i = 0; $i < count($p_array); $i++) {
            genQueryTable($p_array[$i], $sm, $age);
            sms($_POST); 
        }
    }
    else {
        print("No Project specified for incidents query.\n");

Any ideas or pointers to documentation?

Thanks,

Bob
-  




More information about the pmwiki-users mailing list