[Pmwiki-users] Publishing a part of your wiki -- Experience using PmWiki

Patrick R. Michaud pmichaud
Thu Sep 16 07:26:51 CDT 2004


On Thu, Sep 16, 2004 at 10:46:59AM +0200, chr at home.se wrote:
> 
> IMO the concepts are independent.  In my mind I'd actually almost like to 
> have a compeletely separate wiki (field?) for the public part, but allow 
> the public wiki to "import" some pages from the private wiki. I'll have to 
> read the rest of the comments and reply to them a bit later however.

Well, here's an idea -- possibly (probably?) a bad one, but it does point
a direction for discussion.

Background:  I'm already considering the addition of a [:cloak:] directive 
to pages that will allow such pages to be automatically excluded from 
pagelists, search results, etc.  It doesn't make them private/protected--
it just means they don't show up by default when lists of pages are
generated.

Going the other way then, one could define a [:public:] directive that
marks a page as being available for others to search.  For the scenario
Christian poses above, I'd create the public part as a separate
wiki field, and create a special PageStore object that returns pages from
the private wiki's dir only if the page's text contains [:public:].  

Thus, in the public wiki:

    $WikiLibDirs = array(
        // pages from the private wiki field
        new PrivateStore('.../privatefield/wiki.d/$PageName'),   
        // the public wiki field's read/write area
        $WikiDir,                              
        // the farm's default library
        new PageStore('$FarmD/wikilib.d/$PageName'));

The code for PrivateStore would look something like:

    class PrivateStore extends PageStore {
      function read($pagename) {
        $page = parent::read($pagename);
        if (@$page['text'] && strstr($page['text'],'[:public:]')!==false))
          return $page;
        return false;
      }
    }

So, whenever someone on the public wiki requests a page, it looks
in the private wiki's directory first for a page with [:public:] and
uses that if it exists, otherwise it falls through to the other dirs.
If the public wiki attempts to edit the page, it gets saved in the
public wiki's directory ($WikiDir), and given the way I've defined
$WikiLibDirs above, it'll be hidden by the private wiki's version.

Just some ramblings.

Pm



More information about the pmwiki-users mailing list