[pmwiki-users] Looking for a recipe I can steal -- Create a page with no user interaction.
Hans Bracker
hans.bracker at googlemail.com
Tue Aug 1 04:19:20 CDT 2006
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