[pmwiki-users] giving a new page an automatic prefix/suffix

The Editor editor at fast.st
Thu Jan 25 05:14:54 CST 2007


Hans wrote:

> Using separate fields to enter a pagename prefix or suffix, or using
> an option select (dropdown) menu (points a) and c) ) is beyond the
> capabilities of newpageboxplus, and I don't wish to expand it to allow
> such capabilities, as it is not really flexible enough, because the
> HTML input or select tags need to be build into the script.


I think this is an exciting possibility Kathryn.  If one wanted to use
the new page creation capabilities in zap/zapfiles you could very
easily allow a user to supply both the "stem" and the branch of the
page name (lets say in group MyGroup)--just as you described.  The
code snippet would look something like this, though of course you
could shuffle things around however you wanted:

(:zapform:)
(:input select stem Stem1:)
(:input select stem Stem2:)
(:input select stem Stem3:)
(:input text branch :)
(:zap create="MyGroup.{stem}-{branch}":)
(:input submit:)
(:zapend:)

And if you had this code in the config file (untested)...

$myName = FmtPageName('$Name', $pagename);
$myNames = explode("-", $myName);
foreach ($myname as $n => $nn) $FmtPV["$$n"] = "'" . $nn . "'";

You could modify the zap snippet to automatically create a page in the
current group and stem like this:

(:zapform:)
(:input text branch :)
(:zap create="MyGroup.{$0}-{branch}":)
(:input submit:)
(:zapend:)

To list all the groups in the current stem, you could do:

(:pagelist group=MyGroup name={$0}-*:)

Two questions I still have are

1)  As Kathryn asked, is there any way to dynamically generate a
pagelist of all the "stems" in a given group? It would make a nice way
to generate various purpose pulldown menus.

2) Can anyone recommend a better notation for "exploded" group and
page names.  I don't think {$0} and {$1} will really work--and we
definitely can't use the same notation for both groups and names. And
with the notation, perhaps a suggested way to tweak the code.  I would
like n1, n2 (& g1, g2 of course), but couldn't quite figure out how to
make it work. I'd also prefer it to start with n1, not n0.  Didn't
spend too much time on it, thinking the notation should be settled on
first if this is a path some of us want to explore together to achieve
hierarchical groups.

And while I'm at it, what would be REALLY, REALLY nice, is if Pm could
devise a way where the PmWiki core could be set to look for stems when
settling on local config files/css pages.  That is, the hyphens in
Pets-Grooming.Poodles-White would cause PmWiki to first look for
Pets-Grooming.Poodles-White.php, then Pets-Grooming.Poodles.php, then
Pets-Grooming.php and finally for Pets.php.

This should be about all we need for a really powerful, functional
hierarchical groups system.

Cheers,
Dan




More information about the pmwiki-users mailing list