Pm Wiki

Editing (syntax), Administrating (managing installation), Extending (via programming)
pump-up your PmWiki-Fu!
Editing (syntax, ...)
Typically this only require writing access to some part of the PmWiki.
- philosophy with a special key point on a modular design that keeps OUT of it what is not minimally required ! (and DesignNotes)
- PageTextVariables (PTV) will be assigned/evaluated before any conditional markup is evaluated. That means you can use page text variables with conditional markup, but not conditional markup within page text variables.
- PageDirectives
- (:redirect PageName:) Redirects to another wiki page.
- (:title text:) change the title of the page to
text - (:include Group.PageName#from#to:) : include the part of page
- don't forget to make fullpage in the included page or they won't get resolved properly on the including page
- PmWiki:AccessKeys
- use of
(:table border=1 cellpadding=5 cellspacing=0:) (:cellnr valign=top:)'''Title''' (:cell:)'''Lesson learned''' (:tableend:)
for more complex tables. - conditional
if=within a pagelist- e.g.
(:pagelist count=10 order=-size if="date '{(ftime when="-1 week")}'.. {*$LastModified}" fmt=#simple:)used in PageRefactoring
- e.g.
- handling categories
- trying to display book cover from the same categories
- using a pagelist in ReadingNotes.GroupFooter rendered through Site.LocalTemplates
- resulting in ReadingNotes.Supersizing#Footer
- settling down instead to direct backlinks
- using a pagelist in ReadingNotes.GroupFooter rendered through Site.LocalTemplates
- also added to GroupFooter
- Cookbook:ListCategories
- according to discussion with latsami on #pmwiki in freenode (author of http://stdin.fr/Site/LocalTemplates ) pagelist can be used within pagelists
- consider adding the list instead for each category in a folded list
- cf Cookbook:Toggle and the ReadingNotes.Template category section
- also seems problematic to include automatically generated pages with
AutoCreate(cf PmWiki:EditVariables#AutoCreate )- e.g. (:include Category.Psychology#BooksListingStart#BooksListingEnd:)
- trying to display book cover from the same categories
- {$RequestedPage} (here Tools.PmWiki)
- could be useful to properly redirect in splitted pages
- e.g. PiecesOfCulture
- could be useful to properly redirect in splitted pages
- page variables e.g. {$FullName}
- handle input from forms
- PmWiki:Forms
- e.g. Trails
- trails
- used in
- Events.MardiInnovation01#SerieStart for MardiInnovation*
- Events.MBE01#SerieStart for MBE*
- PersonalInformationStream.WithoutNotes for PersonalInformationStream.GroupFooter
- the trail has to be fixed, not generated with a pagelist
- note that this could be useful on the main page or in MyPIM to present cross-sections of the wiki
- i.e. EntryPoint.Trails
- PmWiki:WikiTrails
- used in
- backlink(s) to a page
- PmWiki:PageLists#pagelistlink
- (:pagelist link=ReadingNotes.InformationRules:)
- [[Path:?action=search&q=link=ReadingNotes.InformationRules|wiki (:pagelist link=ReadingNotes.InformationRules fmt=count:) pages linking to notes on the book]]
- search redirection
- using Redirect section of PmWiki:PageListTemplates
- currently working with person search in http://Self (e.g. Cobra jumps directly to Person:CobraCommander)
- page counts
- [[Site/AllRecentChanges|(:pagelist group=-PmWiki*,-Site fmt=count:) pages]]
- PmWiki:Categories
- example of usage http://wiki.mybusinesseducation.fr/Livres/
- PmWiki:PageList
- (:pagelist group=Events order=-time count=3 list=normal fmt=#titlespaced:)
- also useful for menus, updates, etc... a key function to know to keep a wiki scalable
- sign an edit
- ~~~ Fabien
- ~~~~ Fabien June 25, 2010, at 10:57 AM
- found in scripts/author.php
- extended locally with
~~#thanks to Cookbook:ROSPatterns - note that Cookbook:ROSPatterns and Cookbook:ROEPatterns could also be contextual, i.e. ~~~~ in a group could mean be transformed to something else in another
- titlespaced : Outputs wiki page titles with spaces between the words in the title.
- use a template page per group for new pages
- $EditTemplatesFmt = '{$Group}.Template';
- several others, see
- it can become cumbersome, especially for non-editor, to see empty but structured pages
- especially in ReadingNotes
- force list number
- # %item value=0% Blabla (cf cf PmWiki:ListStyles )
- parenthesis within the name of a link
- example [[Wikipedia:Flow (psychology)]] returns Wikipedia:Flow (psychology)
- example [[Wikipedia:Flow (psychology)]] returns Wikipedia:Flow (psychology)
- Easy-to-Edit Website Instruction Videos by Eclectic Tech
Administrating (managing recipes, ...)
Typically this require ssh access to the PmWiki installation and some understand of PmWiki mechanisms.
wiki.d/.pageindexfrom PmWiki:PagelistVariables#PageIndexFile- also contains links in the
Group.Pageformat- which could explain the performance of e.g. groupkeypages.php
- which could explain the performance of e.g. groupkeypages.php
- also contains links in the
- 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=7will remove any page history older than seven days.
- e.g.
- user authentification
- PmWiki:AuthUser (and Cookbook:AuthUser ) which can be used with Cookbook:RequireAuthor to enforce an author name and merge the two
- see also the very complete Cookbook:UserAuth2
- problem with pagelists and non standard actions though
- improved contributions
- better tracking of page visits
- added Cookbook:TotalCounter (but without Cookbook:AuthUser) to Numbers
- better tracking of page visits
- alternative change tracking tools
- Cookbook:InlineDiff to compare changes word by word, not line by line
- Cookbook:TrackChanges to provide links to diff by date and thus display non-visited changes
- Cookbook:ViewDiff to allow to compare diff one to the other
- 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)
- PmWiki:UploadsAdmin to enable it
- 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.
- Wikipedia:Tmpfs
- df -h | grep tmpfs; cat /proc/meminfo; mount; free;
- du -sh /var/log/ /home/utopiah/web/benetou.fr/fabien/ /home/utopiah/web/wiki/
- http://www.howtoforge.com/storing-files-directories-in-memory-with-tmpfs
- http://serverfault.com/questions/43383/caching-preloading-files-on-linux-into-ram
- http://forum.ovh.com/showthread.php?t=49409
- AR RAM Disk by Andreas Roth, discontinued in 2009
- df -h | grep tmpfs; cat /proc/meminfo; mount; free;
- memcached distributed memory object caching system
- Wikipedia:Tmpfs
- 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.shused in Numbers#ContributorsDistribution
- grep author: web/pim/wiki.d/* | sed -e "s/.*=//" | sort | uniq -c | sort -n | tail
- 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
- Cookbook:CleanUrls#URL_rewriting + PmWiki:LayoutVariables#EnablePathInfo
- see also Lighttpd (also for Lighttpd#Apache)
- force author field
suggested at PmWiki:InitialSetupTasks$EnablePostAuthorRequired= 1;
- 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
- cf PmWiki:EditVariables and PmWiki:Forms
- 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-->
- this can be done by PmWiki syntax instead and included in the skin via e.g.
- e.g. Fabien||Utopiah editing a page = special mode
- per group?
- ReadingNotes would show dedicated good practices including startrecall PTV
- per platform?
- mobile browser (to try with http://www.testiphone.com/ ), ...
- Cookbook:DetectMobile
- increase width of text area (:input e_textarea rows=26 cols=80 focus=1:) in Site.EditForm
- 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
- example per page of MisterRoboto
- with overall look&feel for ./wiki.d/Content.MisterRoboto created ./pub/css/Content.MisterRoboto.css
- with list of elements for ./wiki.d/Content.MyAphorisms created ./pub/css/Content.MyAphorisms.css
- thanks to CSS Cheat Sheet
- example per group of Seedea:Oimp/Oimp
- for ./wiki.d/OIMP.* create ./pub/css/OIMP.css
- see also PmWiki:Skins#modify
- example per page of MisterRoboto
$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, ...
- can be very tricky to get to work
- e.g. DVD, with Server2Go
- convenient for wikis used as authoring tool rather than proper wiki
- problems with
chrooton 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
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
- Cookbook:NewPageBoxPlus
- especially useful for wiks aimed at newcomers
- 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
- Cookbook:PmGraphViz leveraging Graphviz rendering
- 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
.
- 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_CURRENTinReadPage()/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
$whencondition does matter a lot- e.g. if ones tries to match multiple lines with the
/sor/mregex modifier after thefulltextevent, nothing will appear since lines have already been splitted
- e.g. if ones tries to match multiple lines with the
- rendering a page or part of page in a recipe
- checked PmWiki:FmtPageName and Cookbook:Functions#FmtPageName but not working
- use instead
MarkupToHTML(RetrieveAuthSection(),...)cf PmWiki:Functions
- access to pmWiki variables from within a recipe
- global
$FarmD,$WikiTitle,$ScriptUrl;
- global
- 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
globalvariable remotely, to do the inverse of the include function and thus benefit fromPageList()and other functions on the remotewiki.d/
Starting point for Development section of the documentation
- ?action=source
- PmWiki:EditingAPI
- simplest way via
curlto add content to a wiki
- simplest way via
- PmWiki:Variables
- PmWiki:Functions
- PmWiki:PageFileFormat
- this has often been discussed on the mailing list, also, so perhaps check the archives.
- Cookbook:Functions Brief description of some of PmWiki's internal functions available to cookbook recipe authors and custom markup developers.
- PmWiki:FunctionList simple list of the functions provided by PmWiki.
See also
- Wikis in general
To do
- consider Cookbook:SkinAlternative Skin your pages within your wiki itself, rather than using downloadable skins
- get PTV value per page version
- useful to see the evolution over time of current page, current chapter, last reading date in ReadingNotes
- check Cookbook:ViewDiff and Cookbook:PageHist
- To Add to my PmWiki:Profiles.Utopiah
- Chat module
- Tools.Vimperator autocommand
- 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.
CONTENT
CONTACT
UPDATES
LAST TWEET
RSS for this page only


