[pmwiki-users] thoughts on PTVs, (:include:) and editing forms

Patrick R. Michaud pmichaud at pobox.com
Tue Nov 13 09:18:45 CST 2007


On Tue, Nov 13, 2007 at 02:56:36PM +0000, Hans wrote:
> Tuesday, November 13, 2007, 2:39:38 PM, Patrick R. Michaud wrote:
> > Actually, (:input textarea:) *can* handle multiline input, at
> > least from page text variables.
> > 
> > For example, to load the contents of $:XYZ from a page into a
> > textarea, one can use:
> > 
> >     (:input defaults source=Group.Page:)
> >     (:input textarea name=$:XYZ :)
> > 
> > The (:input defaults source=...:) line grabs all of the PTVs
> > from Group.Page and uses them as the default values for any
> > input controls of the same name.  
> 
> I tried it before and failed, but i will again. Maybe I fell foul by
> giving it  a curly bracket. Or the trick with name=$:XYZ
> 
> But it seems a bit strange to give the control a different name each
> for each different PTV loading. 

The idea is that there could be multiple textarea (or other)
controls in a single form that are automatically mapped to their
corresponding page text variables in a data page.

> > It sounds like it might work... but I'll have to think about it 
> > a bit to see what we might be overlooking.  It could have some
> > negative impacts on the backend, where we wouldn't have any clear
> > indication that $:anchor was intended to be delimited with [[#anchor]]
> > and not (:anchor: ... :).
> 
> if you provide me with  a pattern for the ptv, I will test it.
> [...]
> either have  [[#sectionend]] stipulated, or just use the next [[#..
> anchor as ending.

I think we might want to require an explicit [[#sectionend]] here,
at least to begin with.  Otherwise every anchor will automatically 
generate a corresponding PTV (and if a page contains a single anchor 
near the top of the page, then the PTV would hold the remainder of 
the contents of the page.

> This approach means we are not using the nice TextSection function.

I don't think we need it here ... the main purpose of TextSection 
is to be able to grab a section with arbitrary start/end anchors
from one of a set of pages.  In the case of using a section as  PTV,
we already know exactly which page we are loading and what anchor(s)
we're looking for.

Here's a pattern to try (requiring the explicit 'end' anchor):

  $PageTextVarPatterns['[[#anchor]]'] =
    "/(\\[\\[#(\\w[-\\w]*)\\]\\](?: *\n)?)(.*?)(?:\\[\\[#\\2end\\]\\])/s";

> TextSection() is really good in helping to get a template section.
> PageTextVariable() is not nice if the PTV does not exist, or th epath
> is incorrect.

How do you mean "PageTextVariable() is not nice..." in this
last part.  What are you wanting it to do instead?

Pm



More information about the pmwiki-users mailing list