Editing (syntax), Administrating (managing installation), Extending (via programming)
pump-up your PmWiki-Fu!
SSL support
- make sure content is served with Protocol-relative URL
- i.e.
//website.tld/path/to/mycontent
rather than https://website.tld/path/to/mycontent
or http://website.tld/path/to/mycontent
- including in particular the skin, the
PubDirUrl
and SkinDirUrl
configurations but also localmap.txt
and icon previews for localmaps
Modern(ish) version
- unpack pmwiki latest
- add configuration file, fix path in it and in the httpd configuration file
- unpack pmwiki bootstrap skin in
./pub/skins/bootstrap-fluid
- configure
$Skin
= 'bootstrap-fluid';
- install Cookbook:Ape
- optionally, only if needed add
Editing (syntax, ...)
Typically this only require writing access to some part of the PmWiki.
Administrating (managing recipes, ...)
Typically this require ssh access to the PmWiki installation and some understand of PmWiki mechanisms.
wiki.d/.pageindex
from PmWiki:PagelistVariables#PageIndexFile
- also contains links in the
Group.Page
format
- added Cookbook:ExpireDiff on the local wiki in order to be able to import page from another wiki with its history yet removing part of its history
- e.g.
?action=expirediff&keepdays=7
will remove any page history older than seven days.
- user authentification
- improved contributions
- better tracking of page visits
- alternative change tracking tools
- add an icon to every link of the intermap with $IMapLinkFmt , cf PmWiki:LinkVariables
- $IMapLinkFmt['Wikipedia:'] = "<a class='wikipedialink urllink' href='\$LinkUrl'>\$LinkText<img src=\"http://upload.wikimedia.org/wikipedia/commons/f/f1/Wikipedia-logo_kucuk.png\" border=\"0\" /></a>";
- PmWiki:Uploads
- PmWiki:UploadsAdmin to enable it
- don't forget URL rewriting (could have to add a specific /uploads/ line)
- set a password by default for safety
- by default
- small size only (~1Mb)
- limited filetype (checked only by extension though)
- Cookbook:SpeedOptimizations
- Cookbook:Stopwatch to measure times
- Copy all the program files, skins, css... into the RAM of the server and run the wiki from there.
- consider fake forced caching by periodically querying the system (through crontab
- see ObjectsExoBrain#SystematicStudy to generalize it
- include the datasets to run tests and compare
- wiki farm
- $FarmD : directory for an entire farm according to PmWiki:PathVariables
- very good fractal strategy
- hard to know when to use it instead of separate instances though
- upgrade
- download the latest, unpack, copy over existing file (cf PmWiki:Upgrades)
- very fast, important for security
- author distribution
- grep author: web/pim/wiki.d/* | sed -e "s/.*=//" | sort | uniq -c | sort -n | tail
- inverted list of the most contributed author (dupes might exist)
- grep author: web/pim/wiki.d/* | sed -e "s/.*=//" | uniq -c | sort -n
- list by pages, not by author
- grep author: web/benetou.fr/fabien/wiki.d/* | sed -e "s/.*=//" | sed "s/ Fabien\|Utopiah/Fabien/" | sort | uniq -i -c | sort -nr | head
- merge dupes by removing case, changing nickname and trailing space
ContributionDistribution.sh
used in Numbers#ContributorsDistribution
- RSS feed on every single page of the wiki
- add <link rel="alternate" type="application/rss+xml" title="RSS" href="{$PageUrl}&action=pagefeed&minor=0" /> to the header of the skin.tmpl
- http://www.w3.org/QA/Tips/use-links
- logical links
- ln -s old.page new.page works but posing problems to the update page
- URL rewrite
- force author field
- internationalization (cf :PmWiki:Internationalizations )
- simply download the localization archive, unpack, edit the configuration file
- note that this is different from translation which can be done via Cookbook:MultiLanguageViews
- UTF-8 seens to be enabled by default, e.g. Chinese and Hebrew are well supported
- personalized edition page
- increase width of text area (:input e_textarea rows=26 cols=80 focus=1:) in Site.EditForm
- PmWiki:SkinTemplates
- per user, per action
- e.g. Fabien||Utopiah editing a page = special mode
- skin.php .= if ($GLOBALS['action'] == 'edit' && ( $GLOBALS['Author'] == 'Fabien' || $GLOBALS['Author'] == 'Utopiah' ) ) LoadPageTemplate($pagename, "$SkinDir/edit.tmpl");
- edit.php .= dedicated menu including documentation, shortcuts using insMarkup to add links, useful pmWiki code, etc
- this can be done by PmWiki syntax instead and included in the skin via e.g.
<!--wiki:Site.EditPersonnalization-->
- per group?
- ReadingNotes would show dedicated good practices including startrecall PTV
- per platform?
- display updates
- (:include Site.AllRecentChanges lines=5:) (found by Person:Franck )
- instead of (:pmfeed feed='Path:Site/AllRecentChanges?action=rss' max_count=5 showtitle=false showpubdate=true newwin=false itemspace=0 showitemdescr=true:) which doesn't display authors and summaries
- display updates within this group only
- !!News [--([[{$Group}.RecentChanges]])--]
- (:include {$Group}.RecentChanges lines=5:)
- spaces or ":" in page name are automatically removed
- this can be used to keep nice presentation without using complex links
- per page or per group skin
$EnableReadOnly=1;
, cf PmWiki:ReleaseNotes, allows to block a wiki against edition
- convenient for wikis used as authoring tool rather than proper wiki
- e.g. DVD, with Server2Go
- can be very tricky to get to work
- despite proper permissions, .flock existing, ...
- problems with
chroot
on existing installations
- new installation work well
- Cookbook:IncludeUrl
- convenient to embbed HTML content
- can be more convenient than
(:html:)...(:endhtml:)
based on path and what has to be included
- impossible to write
"PmWiki can't process your request. Cannot write page to X.Y (wiki.d/X.Y)...changes not saved
depiste proper permissions (755)
@] despite free disk space df
- check inodes via
df -i
- if nothing is free check for the largest consuming inode directory (typically
/var/lib/php5/
)
Specific usage cookbooks
Out of date (01/03/2011) raw list of cookbooks I was then using Path:/pub/cookbook-list.txt
- Cookbook:AddUrlSchemes Add the desired schemes as new InterMap
- rank content
- Cookbook:StarRanker
- consider Object/GroupHeader or Object/GroupFooter
- PageList for rated and yet non rater object
- rating per user
- page creation simplified
- handle slide shows
- Cookbook:SlideShow (see also my comment as I had problems during the installation)
- do not forget the little menu on the bottom right corner
- bugs regarding notes and link to separate slide ( #slideX )
- see the resulting Slideshows
- display graphs
- display equations
- displaying wiki updates within another page
- from external wikis Cookbook:PmFeed
- for internal pages (:include Site.AllRecentChanges lines=5:)
- this can be done per group too (:include {$Group}.RecentChanges lines=5:)
- PmWiki is dependable on PHP limitations : backtracking limit bug
- when you manipulate account and password, remember that
- PmWiki remembers that and treats you as an admin from then on (thus not prompting for an edit password) it remembers you as an admin until you logout (?action=logout) or completely shut down the browser
Extending (programming, ...)
Typically this require ssh access to the PmWiki installation and programming skills. See my pmwiki_recipes.
- naive parsing
- grep -a "text=" wiki.d/Fabien.Principle | sed "s/%0a/\n/g" | sed "s/*/<li>/g" | sed 's/!!!/<h3>/'
- does not start/close the page
- does not close tags
- include a wiki page within another website
- members can then edit a specific group of a wiki and make it appear as part of a larger website
- ini_set('display_errors',0);ini_set('display_errors',0); $pagename="SiteInternet.Bibliographie"; @$_REQUEST['n'] = $pagename; chdir('../wiki'); include_once('pmwiki.php');
- alternatively one can do file_get_content(wiki_url?action=print); with parameters
- hide the wiki aspect via (:noheader:)(:nofooter:)(:noleft:)(:noright:)(:notitle:)(:noaction:)
- avoid loading previous edition
READPAGE_CURRENT
in ReadPage()
/RetrieveAuthPage()
cf PmWiki:Functions
- applied to the 2 visualization recipes on books and contacts
- but not used in the the timeline visualization since older edits do matter
- creating your own markup
- cf PmWiki:CustomMarkup
- note that the
$when
condition does matter a lot
- e.g. if ones tries to match multiple lines with the
/s
or /m
regex modifier after the fulltext
event, nothing will appear since lines have already been splitted
- rendering a page or part of page in a recipe
- access to pmWiki variables from within a recipe
- creating custom Markup()
- preventing escaping thanks to Keep()
- getting pages thanks to ListPages("Pattern.");
- Read the content of a page
$pagename = "MyGroup.MyPage";
//getting the content of the page
$pagecontent = RetrieveAuthPage($pagename, 'read', $authprompt = 'false', READPAGE_CURRENT);
//focusing on content, not meta-data
$content = $pagecontent['text']
- how to query via PmWiki:EditingAPI
- PmWiki is designed like a library that can be called from PHP scripts -- not really.
- typically I (pmichaud) suggest that other packages use the HTTP interface to manipulate the wiki
- it's been very stable -- few changes over minor upgrades
- any "official" effort to use nicely DataPortability formats?
- PmWiki can output RSS and RDF but beyond that, no.
- Get pages and remove the system ones
// update with content
$cleandata = ListPages("/Oimp\./e");
//General cleaning
$cleandata = MatchPageNames($cleandata,array('-*.*RecentChanges,-*.GroupFooter,-*.GroupHeader'));
- is there a way to query an instance remotely? e.g. having access to
global
variable remotely, to do the inverse of the include function and thus benefit from PageList()
and other functions on the remote wiki.d/
See also
To do
- consider Cookbook:SkinAlternative Skin your pages within your wiki itself, rather than using downloadable skins
- get PTV value per page version
- To Add to my PmWiki:Profiles.Utopiah
- Use post to query pmwiki tutorial to add data by SMS to Test.Test?
- else do a Recipe that would periodically check (easier but maybe more resources greedy and less responsive)
- clarify the MarkUp()/Keep() difficulties with Ajax
- list all the functionnalities required and see what recipe is the more adapted
- try to only do recipe that are Seedea-dependant
- modify the editor thanks to one of the several solutions
- write a MarkUp and modify Site.EditForm
- add javascript to handle the textarea which already has an id="text" (thus $('text') with scriptaculous) and use a pmwiki keyword for page listing (no need to write PHP then)
- modify
$HTMLHeaderFmt[]
- PmWiki:Subversion including fully-automated and hassle-free upgrade/backup process
Note
My notes on Tools gather what I know or want to know. Consequently they are not and will never be complete references. For this, official manuals and online communities provide much better answers.