[pmwiki-devel] PageStore precedence for reading & writing

Patrick R. Michaud pmichaud at pobox.com
Mon Nov 6 20:31:41 CST 2006


On Sun, Nov 05, 2006 at 11:54:31AM -0600, Ben Stallings wrote:
> In order to get the read behavior I want, I've got the DataStore 
> object(s) defined after the PageStore objects in $WikiLibDirs... that 
> is, the wiki looks for a page first in wiki.d, then in wikilib.d, and 
> then at last in the database(s).  This makes it very easy to override 
> the default templates and such that DataQuery generates: you just edit 
> the template and save it as a local page, and from then on your template 
> is used instead of the generated one.  Works great.
> 
> The problem is that when I actually want to save data to a database 
> record, it gets saved to a local page instead... the write command never 
> gets sent to the DataStore object because the first PageStore object 
> takes care of it.
> 
> What would you suggest as a solution or workaround?  Should I define 
> $WikiLibDirs differently depending on the current $pagename?  Or is 
> there a more elegant way to go about it?  

Use the $iswrite field of the PageStore class to indicate that
the PageStore should be used in preference to wiki.d/ .
If a PageStore has its $iswrite field set to 1, and the PageStore
indicates that the page being written exists in that PageStore,
then PmWiki will write it to that PageStore instead of wiki.d/ .

This is how http://www.pmwiki.org/wiki/Cookbook/SharedPages works
to identify the PageStore where a page should be written instead
of wiki.d/ .

Pm



More information about the pmwiki-devel mailing list