|
Cookbook /
SharedPagesSummary: Share selected pages among several wikis on a common server, as in WikiFarms
Status: Stable
Prerequisites: pmwiki-2.1.beta10
Maintainer: Pm
Categories: WikiFarms, CustomPageStore
Votes:
DescriptionThe general approach to sharing pages is to create a special shared.d/ directory to hold the shared pages, and then configure the 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 pagesIf we want a wiki to be able to write into the shared pages, then the configuration is slightly more complex: $LockFile = " We also have to make sure the shared.d/ directory is writable by the webserver -- usually 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. $LockFile = " Sharing local.css files on the farmYou can use the farm's pub/css/ directory to share local.css files by redefining the Currently the pmwiki distribution of skins.php uses
NotesNote that any passwords on shared pages are evaluated in the context of the wiki being accessed; i.e., as if the shared pages were stored locally in the wiki. Comments
I think it's possible to configure a group to be shared by setting $WikiDir in a per-group customization file for the group. But I haven't tried this yet. --Pm
Hi, I've written a quick recipe that creates the ?action=share and =unshare function. A very tiny script (ten real lines), that pushes the file from wiki.d to ../shared.d and vice versa in my farm. You still create the new page in a local wiki, but once the page is made you just run the ?action=share function to 'share' it. Running ?action=unshare moves the file out of the shared.d folder back to the local wiki. It's not much, but it addresses the problem without too much work. 2006-Jun-13 JacobMunoz
<?php if (!defined('PmWiki')) exit();
SDV($HandleActions['share'], 'HandleShare');
SDV($HandleAuth['share'], 'edit');
function HandleShare($pagename) {
rename("wiki.d/$pagename","../shared.d/".basename($pagename));
Redirect($pagename); }
SDV($HandleActions['unshare'], 'HandleUnshare');
SDV($HandleAuth['unshare'], 'edit');
function HandleUnshare($pagename) {
rename("../shared.d/$pagename","wiki.d/".basename($pagename));
Redirect($pagename); }
?>
There's not really a way to do this yet, sorry. You might try using a custom InterMap link for files in a shared uploads directory. --Pm
## (:if field1:) is true when hostname contains "field1"
$Conditions['field1'] = (strpos($_SERVER['HTTP_HOST'], 'field1') !== false);
## (:if field2:) is true when hostname contains "field2"
$Conditions['field2'] = (strpos($_SERVER['HTTP_HOST'], 'field2') !== false);
Then you can have conditionals like
(: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.
See AlsoContributors
|