Summary: Bring the wiki's View and Edit commands to ZAP data pages
Version: 1.0
Prerequisites: PmWiki 2.2, ZAP (Acme)
Status: in active use
Maintainer: Ben Stallings
Discussion: EditDataPages-Talk
Categories: Forms, Data

Questions answered by this recipe

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

How can I use ZAP with the wiki's edit function, so that data pages can be viewed like regular wiki pages and edited by clicking the regular Edit link (but using a ZAP form), rather than having to add a separate link or button to edit the page?


  1. Put the following in your config.php:
    ## If the group has an EditForm, use that instead of the site's
     $group = FmtPageName('$Group',$pagename);
     if ((PageExists("$group.EditForm")
      and (!in_array(FmtPageName('$Name',$pagename), 
      $PageEditForm = "$group.EditForm";
    ## Don't include EditForm pages in lists of "normal" pages
     $SearchPatterns['normal'][] = '!\.EditForm!';
  2. Edit the GroupHeader or GroupFooter of the page group where your data pages are stored. Make a template there that will display the data in a page when the page is viewed, like this:
    || Field 1:||{*$:field1} ||
    || Field 2:||{*$:field2} ||
    (The asterisks indicate the data values are to be taken from the page being displayed, rather than from the GroupHeader or Footer page.)
  3. Edit the EditForm page of the group and make a ZAP form, like this:
    || Field 1:||(:input text field1 "{$field1}":) ||
    || Field 2:||(:input text field2 "{$field2}":) ||
    || (:input submit value="Save Changes":) ||||
    (:input hidden savedata "field1,field2":)
  4. Set group and page permissions. You will want to restrict editing of the EditForm page in particular! However, for pages that users will be editing you will need to give them both edit and zap permission -- the first to view the editing form, the second to submit it. You may need to explicitly give the users zap permission to the group even if you have not specified a site-wide zap password.


Because DataQuery uses the ZAP format, this technique can be used to edit database records. It forms the basis for the upcoming DataPlates recipe.

Use of a custom EditForm will prevent your users from deleting data pages in the traditional PmWiki way (by typing "delete"), so you will want to look into either ZAP's delete function or the DeleteAction recipe.

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also



Ben Stallings


See discussion at EditDataPages-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.