[pmwiki-users] Again: Parameterizing Content

Chris Cox ccox at airmail.net
Wed May 17 17:03:45 CDT 2006


Felix E. Klee wrote:
> I've requested a similar feature before.  However, this time I've
> refined my request a bit.  What it's about (roughly):
> 
>   I want to be able to call a wiki page as in the following example:
> 
>     http://www.foo.org/pmwiki.php?n=Main.SomePage&f=sum&inp_x=3&inp_y=5

The PmCalendar, and other recipes parse data similar to this.
The monthly display I can assure you is all dynamically generated (and others
styles as well of course). I simply take the parameters (if supplied) and
use those to tailor the output... the page merely contains (:pmcal:) and
that markup calls my php program which generates wiki content dynamically.  Other
cookbooks might generate HTML.. I took the approach of outputting
pmwiki markup language for page renders.

At work I use a markup called (:shellOut cmd=programname parms=parameters:)
which in turn execs a Unix/Linux shell script called programname at a protected path area
which is assumed to output pmwiki markup language... that way I can quickly
add and test new dynamic extensions (I'm a Unix/Linux dude of course).

Looks like (from local/config.php):

Markup('shellout','directive',
        "/\\(:shellout[         ]*(.*?):\\)/e",
        "shellout('$1')");

function shellout($opts) {
        $args = ParseArgs($opts);
        $shelloutcmd="/usr/local/sbin/" . basename($args['cmd']) . " " . $args['parms'];
        $shelloutoutput = shell_exec($shelloutcmd);
        return $shelloutoutput;
}

I know it probably looks a bit risky.. here... you can change /usr/local/sbin
to something better/safer.  This one doesn't do the work like PmCalendar does
to handle the _GET parameters from the URL line.






More information about the pmwiki-users mailing list