Description

The general approach to sharing pages is to create a special shared.d/ directory to hold the shared pages, and then configure the $WikiLibDirs variable to search the shared directory for pages. Then, move any pages to be shared from their normal wiki.d directory into the shared.d/ directory.

Normally the shared.d/ directory will go in the same directory of the main PmWiki installation, but any directory will work for this.

Sharing pages "read only"

To have shared pages that cannot be directly modified by any of the wikis, use a configuration such as:

The above can be placed in a wiki's local/config.php file, or it can go into a farm's local/farmconfig.php to cause all fields of the farm to use the shared pages.

Then, move any pages that are to be shared from a wiki.d/ directory into the shared.d/ directory. Any pages in the shared directory will then be visible to all of the wikis configured to use that directory.

However, when the shared.d/ directory is read-only as in the above, then any (field) wiki that modifies (edits) the shared page will place the page in its local wiki.d/ directory and use the local copy in preference to the shared copy.

Sharing writable pages

If we want a wiki to be able to write into the shared pages, then the configuration is slightly more complex:

We also have to make sure the shared.d/ directory is writable by the webserver -- usually chmod 777 shared.d/ will do it. The $LockFile setting is needed so that the different wikis sharing writable pages can coordinate edits. The "1" in the new PageStore(...) line tells PmWiki that this is a shared directory, and that PmWiki should go ahead and write the page into this directory if it already exists here.

As before, the above lines go into a local/config.php, or into local/farmconfig.php if the pages are to be shared by all fields in a farm.

Any pages to be shared should be moved from wiki.d/ into the shared.d/ directory.

You can have more than one writable shared directory. Notice that there is still only 1 $LockFile.

(:if field1:)
This content is visible only to people accessing field1.mydomain.com.
(:if field2:)
This content is visible only to people accessing field2.mydomain.com
(:if:)
Everybody sees this.

Is there an easy way to automatically indicate on shared pages that they are shared? e.g. define a new conditional mark-up along the lines of the one above and put it in an all group header? Francis

I found that I needed to use double quotes and a backslash in front of $FullName in the PageStore() calls, as demonstrated in WikiFarmAlternative - I combined this with the share-unshare recipe above into sharedpages.phpΔshi