Forms-CreatePages

You've already seen code that would create a new page in Forms-Logging, but we'll be more specific here...

Let's say you want to allow a user to enter a pagename (the field will be named pn) and create a page based on that name. But you want to pre-populate the page with a few basic lines or perhaps something more elaborate in terms of a template...

(...uninteresting stuff)
echo "This is the first line" >${pn}
echo "This is the second line" >>${pn}
(uninteresting stuff follows...)

Or, if you wanted to copy in a template:

(...uninteresting stuff)
cp Mygroup.Mytemplate ${pn}
(uninteresting stuff follows...)

Perhaps your form allows the user to enter a title and you want to create the page from the title:

(...uninteresting stuff)
set -s pn = `mkpagename ${title}`
echo "(:title ${title}:)" >${pn}
(uninteresting stuff follows...)

Often after creating the page you want to go and view or edit the page. Let's use the title example and add in the code to redirect there:

(...uninteresting stuff)
set -s pn = `mkpagename ${title}`
echo "(:title ${title}:)" >${pn}
wikish_form redirect tgt="${pn}?action=edit"
(uninteresting stuff might follow...but is ignored because we've already redirected to another page)

Using the name & favorite color example from Forms-PTV, here's how you could do the same sort of thing to save each vote on its own page so subsequent votes would not overwrite previous votes:

(...uninteresting stuff)
set -s pn = `mkpagename Vote-${name}`
echo "${name}" >${pn}$::name
echo "${favorite}" >${pn}$::color
echo "`ftime`" >${pn}$::time
(uninteresting stuff follows...)

Now you would have a series of pages named Vote-Sam, Vote-Sally, Vote-Jim, etc and each would contain the person's name, favorite color, and time of voting.