[pmwiki-users] page actions additional feature request or formtitle expand (david roundell)

john.rankin at affinity.co.nz john.rankin at affinity.co.nz
Sat Jan 3 19:35:17 CST 2009

> Send pmwiki-users mailing list submissions to
> 	pmwiki-users at pmichaud.com
>    3. Re: page actions additional feature request or	formtitle
>       expand (david roundell)
> Date: Fri, 2 Jan 2009 21:43:20 +0000
> From: david roundell <roundelld at hotmail.com>
> john
> again, thanks for the suggestions -
> quote: "
> So the action function
> needs to be a variant on formtitle's MakeFormLink function,
> that redirects to the url corresponding to the pagename
> with the given title. Essentially, the return MakeLink(...)
> when count($n)==1 has to become Redirect(MakePageName(...))"
> i did try editing formtitle but am not having much joy with the redirect.

I have updated the formtitle.php script on PmWiki:

On my test wiki "It just works" (tm).

Here is what I did to test it.

1. in my Issue group, set up a FormTemplate with a field of type
"title" e.g.

:Description:description (title)

This does 2 things: it wraps (:title ... :) around the contents of
the field; and (this is really important) it puts the contents into
the [=change summary=] position in RecentChanges.

The formtitle script relies on looking in RecentChanges for the
[=change summary=] and translating this into the [[pagename]]
from the start of the line.

2. in my Issue group, set up a NewIssue page with (:wikiform:)

This is where I post new entries and it's the page the title
lookup will redirect to if the requested title is not found in

3. on my Issue.Issue page, put a (:goto:) directive; this is a
new feature in the formtitle.php script

The goto directive looks in FormTemplate for a field of type "title"
and uses the prompt text it finds (in this case, "Description") to
prompt the reader to enter title text in a one field form.

When the reader presses "Go", formtitle looks up the entered
text in the [=change summary=] on RecentChanges and redirects
PmWIki to the corresponding pagename. If it doesn't find the
text in any [=change summary=], it redirects to the NewIssue
page, with the description field pre-set to the text the reader

If your new entry page is called $Group.New$Group, this will
just work. If not, change the goto directive to read:

    (:goto new=Groupname.PageWithEntryForm :)

4. provides a new ?action=goto

The (:goto:) directive generates a request of the form


If new is omitted, the script defaults to use $Group.New$Group.

5. the critical factor is the [=change summary=] on RecentChange

This only works because the title field type causes the value
entered to be put into the change summary area. It returns the
first name it finds with this title. This is fast, but fragile. If
someone edits a page using the regular Edit link (rather than
via the form template), we have no control over what goes into
the change summary field, so the title text could be lost from
RecentChanges (even though it's still in the page itself).

Hope that makes sense -- let me know if you run into any

> the link on the page - [[?test]] is taking the user onto Main.Entries
> where all the entries are listed. it is filtering out other results and
> ends up with the sole entry for the server named 'test'. except i would
> ideally like the link to redirect the user straight to the entry for
> 'test' rather than have them click through to the entry from Main.Entries.

The new (:goto:) directive now does this.
> using your suggestion above i changed formtitle to read -
> if (count($n)==0) return MakeLink($pagename,$newentry,
> str_replace('"','&quot;',$title),$suffix,$fmt);
> elseif (count($n)==1) return Redirect($MakePageName,$n[0],$title,$suffix);
> but this does not redirect as i would have hoped.
> is there something i'm missing here? i'm not using the summary field when
> editing so perhaps the text from the summary needs to be picked up on
> RecentChanges??

I think my explanation of the revised formtitle script answers your
questions. If not, let me know.
> thanks
> david


More information about the pmwiki-users mailing list