[pmwiki-users] thoughts on PTVs, (:include:) and editing forms
editor at fast.st
Wed Nov 14 13:04:13 CST 2007
On Nov 13, 2007 7:42 PM, Hans <design5 at softflow.co.uk> wrote:
> Tuesday, November 13, 2007, 11:43:12 PM, DaveG wrote:
> > How do you handle retrieving the wiki-text (ie the text to put in the
> > textarea for editing), and saving it back and getting the page text (ie,
> > the text to display on the web-page)?
> The primary approach is now to use page text variables, and adding the
> [[#NAME]] ... [#NAMEend]] syntax as a PTV pattern, so anchored
> sections can be retrieved as PTVs. (To find a solution like this was the
> purpose of this list thread). The retrieval works well with the
> (:input defaults source=PageName:), as Pm suggested in this thread.
> Saving the changes is done via the PTV update function in Fox.
> The PTV fields named in the edit form will be updated and the page
> saved with the updated text.
This is a brilliant approach, Hans. I would have never dreamed of using
PTV's to make editable anchor sections. Kudos... It has me considering all
sorts of possibilities.
> I still have not given up on a second approach, which can retrieve
> page sections (anchor marked sections) by passing the pagename with
> the section marker(s) to the TextSection function, which returns the
> section, or the whole page, according to the anchors passed. This is
> used to set a InputValues['text'] variable, with the effect that it
> appears inside the edit textarea control named 'text', for editing.
> In this case saving is not done via PTV update, but I use a new
> text 'replace' routine for this: instead of inserting text content at
> the bottom it replaces all. The trick is that it can act on the section,
> so the rest of the page text is unaffected. Giving a pagename as
> target, the 'replace' will replace all of the page text with the new
> text from textarea. Giving a pagename with anchor will only replace
> the section from anchor to next anchor. Or from anchor to another
> anchor given. In a way it is similar than retrieving template
> sections, only turned around to replace target sections.
ZAP has been doing exactly this for a long time. Where the target is a page,
it edits the entire page, where the target is an anchor, it edits the
corresponding section. The code is fairly trivial, as long as there is forms
processor capable of managing it. Feel free to take a look if you wish. Its
around line 154 in the ZAP toolbox.
I'm curious though why you prefer this solution vs using PTV's which are so
well supported in the core?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pmwiki-users