[pmwiki-users] Shared Pages

Simon nzskiwi at gmail.com
Mon Sep 14 02:03:40 CDT 2009


FYI,on page http://pmwiki.org/wiki/PmWiki/LocalCustomizations

<http://pmwiki.org/wiki/PmWiki/LocalCustomizations>I found the following
(just shows you have to know where to look)

How do I get the group / page name in a local configuration file (e.g. *
local/config.php*)?

Use the following markup in pmwiki-2.1.beta21 or newer:

## Get the group and page name
$pagename = ResolvePageName($pagename);
$page = PageVar($pagename, '$FullName');
$group = PageVar($pagename, '$Group');
$name = PageVar($pagename, '$Name');



cheers

Simon

2009/9/13 Petko Yotov <5ko at 5ko.fr>

> On Saturday 12 September 2009 07:06:09 Simon wrote:
> > In config.php I have
> >   $WikiDir = new PageStore('wiki.d/$Group/$FullName');
> >   $LockFile = "/home/tahi/public_html/pmwiki/wikishared.d/.flock";
> >   $WikiLibDirs = array(
> >      &$WikiDir,
> >      new
> > PageStore('/home/tahi/public_html/pmwiki/wikishared.d/$Group/$FullName',
> >  1), new PageStore('$FarmD/wikilib.d/$FullName'));
> >
> > What I want to achieve is having some shared groups of pages that can be
> > updated and added to (ie new pages) from both websites.
> > Where a group is not in the shared directory I want it to update the
> local
> > website folder (this happens now).
> ...
> > existing pages are updated in their existing locations, but new
> > pages are added in to local folder.
> ...
> > If anyone can suggest how I can have all new pages in a shared group only
> >  be added the the shared directory I would appreciate it
>
> You can re-define the $WikiLibDirs array in two local/SharedGroup.php files
> in
> both wikis:
>
> <?php
> ## only alter the directories when a page is posted in this group
> if (@$_REQUEST['action']=='edit'
>  && preg_grep('/^post/', array_keys($_REQUEST) ) ) {
>  $WikiDir = new PageStore('$FarmD/shared.d/$FullName');
>  $WikiLibDirs = array(  &$WikiDir,
>    new PageStore('$FarmD/wikilib.d/$FullName')  );
> }
>
> > I can test for a pagename in config.php by using   $pagename =
> > ResolvePageName($pagename);
> > How can I test for a groupname in config.php?
>
> You can get the group by something like this (at the end of config.php):
>
>  list($group, $name) = explode('.', ResolvePageName($pagename));
>  if ($group=='PmWiki') { /*do something...*/}
>
> Petko
>



-- 
____
http://kiwiwiki.co.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090914/8cc63abd/attachment.html 


More information about the pmwiki-users mailing list