[pmwiki-users] FOX-question: reading / writing plain text files ?

Hans design5 at softflow.co.uk
Sat Feb 6 05:26:49 CST 2010


Saturday, February 6, 2010, 9:50:37 AM, Knut Alboldt wrote:

> But I've no idea how to write into a textfile instead of a pmwiki-page.
> Is it possible ? Do I have to write a Handle for this ?

Knut, I can give you not many answers, and i hope your questions are
not just addressed at me!

Fox is handling form submission, and results are usually saved in
a wiki target page, or several. This uses the standard PmWiki
UpdatePage() function. You find the call to it in Fox function
FoxUpdatePages(). I say "usually", because Fox has been extended over
the years to cater for a few different things.
So there is an option of "display results ony" (not saving to wiki
page). Another one is "preview", again a display chiefly.
Then there is a "mail" option, where the target is a wikipage
containing email adresses, each being used to send a notification
email to.
All these you find in the FoxupdatePages() function, and this would
be the place to modify to add a "save to textfile" option.
But there is no internal hook for this.
Also: Fox has no hook for a post-processing function.
To add one may be useful, but I've found no need so far, and then
there is the question when th epost-processing shall take place?
After each target page process, or after everything is done?

It may be better to look at it from a more general perspective,
not as a Fox question:
How can one add capability to PmWiki (as a recipe) to save to plain
text, but use a standard wiki page name to define the target, say by
defining a special group "Text", and all pages in it will be file
names for text files. So setting in a Fox form
target=Text.SomeTextDocument will then save to a target file with name
SomeTextDocumnet.txt in some predefined directory (in pub/textfiles/ for
instance).

I imagine this requires a new PageStore class. Same as was done for
DataPlates to read and save pages into a DataBase.
Maybe this exists already?
But I am totally out of my depth to know how to set this up.

cheers,
  ~Hans




More information about the pmwiki-users mailing list