[pmwiki-users] Create pages with default content

Patrick R. Michaud pmichaud at pobox.com
Mon Dec 18 13:21:58 CST 2006


On Sun, Dec 17, 2006 at 12:40:28AM -1000, Sivakatirswami wrote:
> I asked this on the 13th, got no answer...
> let's try again with less verbiage:
> 
> simply:
> 
> 1) this is about page creation
> 2) where new pages contain some default text (or markup)
>      --could be some: (:include, (:pagelist, (:comment data:)
> # pre-filled data... etc. whatever...

Assuming this is about "page creation" -- i.e., what should happen
when someone attempts to _create_ a page in a new group (as opposed
to viewing a non-existent page in a new group), then
http://www.pmwiki.org/wiki/Cookbook/EditTemplates is what
you're looking for.  So to answer your specific questions...

> 1. prefill new default home pages for groups with pre-defined page lists

To pre-fill all new Group.Group home pages upon editing:

    $pagename = ResolvePageName($pagename);
    $group = PageVar($pagename, '$Group');
    if ($pagename == "$group.$group")
      $EditTemplatesFmt = 'Site.NewGroupTemplate';

When someone attempts to edit a page that has a name of the form
"Group.Group" and that doesn't exist, the edit form will be
pre-filled with the contents of Site.NewGroupTemplate.

> 2. prefill new default pages in a specific group;
>      --Staff.AnyNewStaffMember

In local/Staff.php:

    $EditTemplatesFmt = 'Site.StaffTemplate';

This causes any new page in the Staff group to be automatically
filled with the contents of Site.StaffTemplate when it is edited.

Pm




More information about the pmwiki-users mailing list