[pmwiki-users] How to do template variable substitution when creating a new page via a form

Hans design5 at softflow.co.uk
Tue Mar 31 01:34:27 CDT 2009


Monday, March 30, 2009, 11:55:48 PM, Randy Brown wrote:

> I've used the Powertools recipe to create a form through which a user
> can create a new page, but I apparently don't know how to replace the $
> $variables in the page's template.

> My form looks something like this:

> (:fox nlform template=Form.MyTemplate:)
> NewPageName: {$$(serialname MyGroup MyPageBaseName- )}
> (:input hidden target '{Form.MyForm$:NewPageName}':)
> (:input hidden pagename 'NewPageName':)
> (:input text pagetitle size=40:)
> (:input submit post "Submit":)
> (:input end:)
> (:foxend nlform:)

> The MyTemplate page contains:

> (:title $$pagetitle:)
> PageName: $$pagename

> Does the Powertools recipe not handle $$variable substitution, or am I
> doing something wrong?

PowerTools does not do the variable substitutions, these are done by
Fox when the form gets submitted.
use either
NewPageName: {$(serialname MyGroup MyPageBaseName- )}

or change your form to

(:fox nlform template=Form.MyTemplate:)
(:input hidden pagename  '{$$(serialname MyGroup MyPageBaseName- )}':)
(:input hidden target {$$pagename}:)
(:input text pagetitle size=40:)
(:input submit post "Submit":)
(:input end:)
(:foxend nlform:)

or shorter:
Form:
(:fox nlform template=Form.MyTemplate:)
(:input hidden target '{$$(serialname MyGroup MyPageBaseName- )}':)
(:input text pagetitle size=40:)
(:input submit post "Submit":)
(:input end:)
(:foxend nlform:)
Template:
(:title $$pagetitle:)
PageName: $$target


  ~Hans




More information about the pmwiki-users mailing list