[pmwiki-users] Looking for a recipe I can steal -- Create a page with no user interaction.
Jeff Ullmann
JeffUllmann at navio.com
Tue Aug 1 10:49:07 CDT 2006
Hans,
This looks great and I can't wait to try it out.
jU?
Navio Systems, Inc.
-----Original Message-----
From: Hans Bracker [mailto:hans.bracker at googlemail.com]
Sent: Tuesday, August 01, 2006 2:19 AM
To: Patrick R. Michaud
Cc: Jeff Ullmann; pmwiki-users at pmichaud.com
Subject: Re: [pmwiki-users] Looking for a recipe I can steal -- Create a
page with no user interaction.
On 19/07/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> Here's a brief recipe that will create HomePage, GroupHeader, and
> GroupFooter automatically if they don't exist when a page is created
> in a group:
>
> function AutoGroupPages($pagename, &$page, &$new) {
> global $IsPagePosted, $GroupPagesFmt;
> if (!$IsPagePosted) return;
> SDV($AutoGroupPagesFmt, array(
> '{$Group}.HomePage' => 'Templates.HomePage',
> '{$Group}.GroupHeader' => 'Templates.GroupHeader',
> '{$Group}.GroupFooter' => 'Templates.GroupFooter'));
>
> foreach($AutoGroupPagesFmt as $n => $t) {
> $n = FmtPageName($n, $pagename);
> if (!PageExists($n)) {
> $t = FmtPageName($t, $pagename);
> WritePage($n, ReadPage($t));
> }
> }
> }
>
> $EditFunctions[] = 'AutoGroupPages';
>
> As written above, the pages are created based on their equivalents in
> the Templates group.
I added this function as a (optional) feature to the newgroupbox.php
script, so a number of pages in a new group can be created
automatically, all what is necessarty for an author is to type in the
group name in the newgroupbox.
http://www.pmwiki.org/wiki/Cookbook/NewGroupBox
Thank you Pm for the function!
~Hans
More information about the pmwiki-users
mailing list