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

Patrick R. Michaud pmichaud
Tue Sep 21 12:09:45 CDT 2004


On Tue, Sep 21, 2004 at 11:11:58AM +0200, Knut Alboldt wrote:
> >> what about a server-task that would copy these specific pages (e.g. each
> >> marked by a [:public:]-tag) to the public wiki ?
> >> would require crontab access and scripting (bash/sh/perl) on the 
> >webserver
> >> The page-names and groups should remain the same.

In PmWiki 2, it'd be possible to write a custom EditFunction that would
check the page text for [:public:] and if it is there then the page
gets saved to a second public wikidir in addition to the normal one.
Thus you wouldn't need a separate script or crontab to find all of
the public pages and copy them--it would occur automatically whenever
a ([:public:]) page is saved.

In PmWiki 2 this would look something like (in config.php):

   function PostPublicPage($pagename,&$page,&$new) {
     global $IsPagePosted,$PublicWikiDir;
     if ($IsPagePosted && strstr($new['text'],'[:public:]')!==false)
        $PublicWikiDir->write($pagename,$new);
   }

   $EditFunctions[] = 'PostPublicPage';
   $PublicWikiDir = new WikiStore('/file/path/to/public/pmwiki/wiki.d');

There are many ways to do it--one could also key the saving of the public
copy of the page based on a checkbox in the edit form, a "Save Public"
button in the edit form, an ?action=copypublic action, etc.

Pm



More information about the pmwiki-users mailing list