Page Text Variables
Fox can add content and also update PTVs on a target page. Content will be added first, PTVs updated last in Fox's processing.
By using the parameter ptvtarget=PageName
Fox will update any PTV on page PageName
with new input from an input field with the name of the PTV. Fox will update all PTVs it finds matching input field names. It will use whatever format the PTVs got, just replacing the values. It will not create new PTVs automatically, unless the ptvfields= parameter is used, specifying target PTVs, or an input field is named for instance like (:input text $:someptv:)
with $: before the PTV name. In the form one can then also use replacement variables with syntax like {$$:someptv}
, for instance inside markup expressions, which get evaluated when the form is processed.
Using parameter ptvfields=name1,name2,name3,..
will restrict the PTV update to the named PTVs. If the target page has not got a PTV named with ptvfields, it will be created as a hidden PTV.
Using parameter ptvfmt=keyword
will create PTVs named with ptvfields and not existing in the target page according to the keyword format:
-
ptvfmt=text
- text list format, as used in the recipeinfo section. Syntax is Name: Value, starting on a new line.
-
ptvfmt=deflist
- definition list format, syntax is : Name : Value , starting on a new line.
-
ptvfmt=section
- anchored section format, syntax is ''
[[#name]] multi line value... [[#nameend]]
-
ptvfmt=hidden
- (default, no need to specify this) hidden PTV format with syntax
(:Name: Value:)
-
ptvfmt=extra
- custom hidden PTV format defined in foxforum.php with syntax
(::Name: Value::)
By default if a field is empty when the form gets submitted, Fox will ignore this field and will not clear any existing value of a PTV with the field name. Instead to clear a PTV you need to input a special string defined with config variable $FoxClearPTVFmt
, which is by default NULL
. This default behaviour can be changed with the ptvclear parameter:
-
ptvclear=1
- any empty field when submitted will clear a corresponding PTV.
-
ptvclear=name1,name2,name3,..
- any empty field named will clear the corresponding PTV.
To add or update PTVs on more than one target page,
- either provide a target page list for ptvtarget: ptvtarget=Target1,Target2,Target3 etc. Any ptv parmeters given will be applied to processing for all target pages.
- or use one or several markups
(:foxptv Target options...:)
. Any ptv parameters used in each markup will be applied for the specific Target page process.
Parameter ptvupdate=1
used in the (:fox formname ..:)
markup is for special cases to avoid duplicating target and ptvtarget parameters: With target=PageName template=Template ptvupdate=1 a new page can be created according to the template provided, with PTVs being created through the template and input values. But if such a form submits again to the same page, the template will be ignored and only existing PTVs will be updated. No new PTVs will be added.
Using PmWiki's (:input default ...:)
with PTVs
At present one can prefill an input control with the value of a PTVs using syntax like this:
(:input default $:ptvname {$:ptvname}:)
or if the value may contain spaces, like this:
(:input default $:ptvname "{$:ptvname}":)
If you got an array of controls ptvname[] (very useful for checkboxes), then use this syntax:
(:input default $:ptvname[] {(foxfixptv $:ptvname)}:)
The markup expression foxfixptv converts any PTV using a separator other than spaces to a string with spaces, which PmWiki's input default understands. No other expressions are allowed inside foxfixptv, just the PTV name, with no curly brackets.
<< Page Variables | Index | Filter Functions >>