[pmwiki-users] Fwd: Passing Variables in a Markup

The Editor editor at fast.st
Wed Mar 22 13:15:20 CST 2006


Thanks for the suggestions on where to find the documentation on
markups.  I didn't realize there was so much on the PmWiki site that
was not on the distributed version.  Should have looked there first.
Anyway, have been busy reading and studying--and took a stab at
revising my recipe.  Doesn't work.  Perhaps someone can spot my
mistake and answer a couple questions while at it.

Here are critical parts of my current recipe:

Markup('htpasswdform', '<split', '/\\(:membership:\\)/ei',
"HtpasswdForm(\$pagename)");
function HtpasswdForm($pagename) {
 global $HtpasswordAuth, $HtpasswordUsrAuth, $AuthId;

I changed it to:

Markup('htpasswdform', '<split', '/\\(:membership (\\d+):\\)/ei',
"HtpasswdForm('$1',\$pagename)");
function HtpasswdForm($nextpage,$pagename) {
 global $HtpasswordAuth, $HtpasswordUsrAuth, $AuthId;

The goal was to pass an optional variable into the markup to determine
which page the browser forwards to after the script is processed.

I also have some questions on the original markup the documentation
didn't seem to answer:

Why does the original script have "ei", rather than just e for the
$when parameter?

Why is "d+" suggested in the docs to stand for an input parameter?

In the recipe, it looks like $pagename is global in the recipe but not
declared.  Will $nextpage by the same?  i.e. Can I drop it into any of
the functions, anywhere?

Will this parameter ($nextpage) be optional--or required. And if it is
not supplied, would not $pagename pass into $nextpage when it calls
the function?

Thanks for any help. It's starting to make more sense, but it's coming slow.

Caveman




More information about the pmwiki-users mailing list