Experiences on a Wiki Farm

Katherine Bouton
Centre for Global Atmospheric Modelling
Department of Meteorology
University of Reading
Reading, United Kingdom

My Wiki Farm experience

I have recently (7/05) moved from three separate wiki installs (of version 1.x) to a WikiFarm using the latest versions of 2x as it comes out. As a novice I have learned ALOT from the fast response of members of the PmWiki/MailingLists and through searches of that list at http://search.gmane.org/search.php?group=gmane.comp.web.wiki.pmwiki.user

You can see my my Wiki Farm Experience and see if it helps in your set up.

My biggest hint - use Blocklist2 - can't tell you how many mornings I'd return to a site full of nasty 'ol links

Things I've learned from the list

Write these answers in your farm/local/farmconfig.php or field/local/config.php file


How do I detect if minor edit has been selected? I only want mailposts sent if its not checked as a minor edit.

 $EnableMailPosts = 1;
if (@$_POST['diffclass'] == 'minor') $EnableMailPosts = 0;

Or, more succinctly: $EnableMailPosts = (@$_POST['diffclass'] != 'minor');

How do I share files across a farm?

 $WikiLibDirs = array(&$WikiDir,
                  	new PageStore("$FarmD/shared.d/\$FullName"),                 
                  	new PageStore("$FarmD/wikilib.d/\$FullName"));

Then if those pages are edited, make sure they are copied to the correct directory

 $group = FmtPageName('$Group', $pagename);
 if($action == 'edit' && $group == 'Shared') 
      				$WikiDir = new PageStore("$FarmD/shared.d/\$FullName");

How do I add the author's name and a link to her profile page to the footer w/o changing the default skin template

 XLSDV('en', array(
     'Page last modified on $LastModified' =>
     'Page last modified on $LastModified by $LastModifiedBy'));

(tested on skins: pmwiki, lean, neutral and evolver)


How do I remove various parts of the page when editing a page -- 1 is show it; 0 is don't show it

 global $action;
 if ($action=='edit') { SetTmplDisplay('PageHeaderFmt', 1);
			 SetTmplDisplay('PageFooterFmt', 1);
			 SetTmplDisplay('PageTitleFmt', 1);
			 SetTmplDisplay('PageLeftFmt', 1);};

How do I add css to pages to create correct for print preview from the browser menu

 $HTMLStylesFmt[] = "
 	@media print {
	#wikilogo,#wikihead,#wikicmds,#wikifoot,#wikileft, #message {display:none}
	#wikitext {margin:.5em}
	body {width:auto;font-family:serif;font-size:14px;margin:.5em}
	} ";

How do I add wikipedia style image to indicate offsite links

 $UrlLinkFmt = "<a class='external' href='\$LinkUrl'>\$LinkText</a>";

How do I use local.css in my farm

Currently the pmwiki distribution of skins.php uses $PubDirUrl rather than $FarmPubDirUrl You can locally configure it to look in FarmPubDir as well with:

 $PageCSSListFmt = array(
  '$FarmD/pub/css/local.css' => '$FarmPubDirUrl/css/local.css',
  '$FarmD/pub/css/$Group.css' => '$FarmPubDirUrl/css/$Group.css',
  '$FarmD/pub/css/$FullName.css' => '$FarmPubDirUrl/css/$FullName.css',
  'pub/css/local.css' => '$PubDirUrl/css/local.css',
  'pub/css/$Group.css' => '$PubDirUrl/css/$Group.css',
  'pub/css/$FullName.css' => '$PubDirUrl/css/$FullName.css');

How do I add a SiteWide LatestNews postit-like note to a page?

Write a Latest News page In your farmconfig.php define a custom wikistyle

WikiStyle['latestnews']['class'] = 'latestnews';

Add to a local.css file (see above) and set style as you want

 .latestnews {
 display: block;
 border: 1px solid #ccc;
 padding: 5px;
 background: yellow;
 text-align: left;
 font-size:smaller;
 width:	200px;
 float:	right; 
 margin-left:0.5em;
 }

Then add to whatever page you want the latest news bulletin to pop up at, where 30 is the numbers of days since it was last modified - ie its no older that 30 days.

Note - it won't show like this on this page cause the above WikiStyle is not defined inthe PmWiki config file.

 (:if lastmodified Test.LatestNews 30:)
 >>latestnews<<
 (:include Test.LatestNews :)
 >><<
 (:ifend:)

On a page by page basis, this style would look like this:

%define=latestnews bgcolor=yellow font-size=smaller padding=5px border=1px width=200px float=right%
(:if lastmodified Test.LatestNews 30:)
If no text is in the yellow box, edit [[Test.LatestNews?action=edit|Test.LatestNews]] to make sure it is newer than 30 days old
>>latestnews<<
(:include Test.LatestNews :)
>><<
(:ifend:)

If no text is in the yellow box, edit Test.LatestNews to make sure it is newer than 30 days old

Latest News

PmWiki continues to move towards 2.0.0.

Pm's birthday is this Saturday.
Happy Birthday!

The O'Reilly Open Source Convention in Portland, Oregon was really cool. In fact it rained the whole time.

so sorry PKHG

edit news


How do I make a custom format for LastModified ?

I want $CustomLastModified would use $TimeFmt='%b %d, %Y';

Again from Pm

$FmtP['/\\$CustomLastModified/e'] =
       'strftime("%b %d, %Y", $PCache[$pagename]["time"])';

To enable it as markup, you'll also need:

Markup('{$CustomLastModified}', '{$fmt}',
       '/{\\$CustomLastModified}/e',
       "FmtPageName('\$CustomLastModified', \$pagename)");


I have an acronym which is interpreted as a spaced wikiword which I don't want it to be spaced. Onthe forum I just found out that "In version 2.2.0-beta14 (just released), you can now set:

    $WikiWordCount['WikiWord'] = -1;

which in addition to preventing WikiWord from becoming a link will also cause it to ignore any $SpaceWikiWords setting. "

This works great for me (currently using 2.2.0-beta63)

--- Categories: WikiFarms, Layout