[pmwiki-users] fox: custom ptvfmt

Hans design5 at softflow.co.uk
Mon Mar 3 09:04:27 CST 2008

Monday, March 3, 2008, 2:28:03 PM, noskule wrote:

> I don't no fox so well jet but it seams customization should be possible
> in one way or the other cause the statement below seams to check only 
> if  value is empty but not if the ptv exists. So with foxadd the ptv 
> would be posted a second time. This could happen if a user submit an 
> empty field.

>> You could add a PTV of custom format using foxadd conditionally:
>> (:if equal {TargetPage?:Text} '':)
>> (:foxadd target=TargetPage template=PageFormTemplates.HiddenSection:)
>> (:ifend:)

My advise was premature. This may work, but only if the target page
is already determined when the page loads.
If the target is created using replacement variables the (:if
conditional cannot get it right, since it has not got the value yet.

So now i am working on a solution whereby the conditional is
evaluated when the form is submitted.
MarkupExprPlus is offering an if and a test expression, and these can
be evaluated when a form is submitted.
But i have to do a few adjustment to fox.php to allow for graceful
failures for cases where a target cannot be determined by such

> In the other hand, how many versions of ptvfmt are needed. Threre are 
> probably two, visible and invbisible ones. The other criteria are about
> (accidently) "unbreakable" and that's the section version. So IMO it 
> could make sense to add a hidden section ptvfmt in fox.

In fox.php there are at present five PTVs defined to be added via
ptvfmt= option, the three standard ones and two special ones:

text: value              (visible)

:deflist : value         (visible)

(:hidden: value:)        (hidden)

[[#section]]             (visible)

(::extra: value::)       (hidden)

> One more thing is that hidden section makes it possible to separate
> layout from content and change the layout on the fly for all pages.

Yes, i use the same technique in FoxForum

Another thing:
Fox has by default $PostDirectives = false;
This will 'defuse' any posting of markup directives of
syntax (:.....:), and of markup expressions.
For instance any posted :) is written as :)
so with this default it is not possible to even accidentally post
::) and accidentally set the ending marker for the
(::name: value::) PTVs.

Obviously posting  a smiley of :) will be rendered as :)
so not much harm done there either.


More information about the pmwiki-users mailing list