March 4, 2009
How To /
Work With Templates

This pages is for administrators who want to tune their wiki layout.

Templates or - more exactly - template files are the basis from which the ProWikiSoftware creates the wiki pages. Typically a wiki has a single template (ok, two, if you count the printer friendly template) that rarely changes over time. So only a person that configures wikis needs to know the details.

The template used is defined by TemplateFile. If the file is located in an upload directory, the definition will look like:

  • TemplateFile=@/upload/JohnSmith/template-xyz.txt
so you (assuming that you are the administrator John Smith) can upload and change the template. To fiddle with the template, set up a test page and put this assigment into its ContextPage. After verifying that the new template is working, copy this assigment to the top context page.

A template file is technically a normal HTML page. It contains a number of insertion markers like {PageTitle} or {PageText} that tell the software where to put the dynamic parts. All insertion markers are within curly brackets. All insertion markers are replaced by some content or nothing (if the insertion marker is wrong or no content for it is available).

Predefined insertion markers / variables

predefined insertion markersneededresults in the insertion of
PageTitleyesthe page title or the name of an action (e. g. searching)
PageTitleCommentyesthis is usually empty, sometimes it holds additional information (e. g. the redirection text)
PageTextyesthe page text or the result of an action
LinkBarTextHor(1)the dynamic link bar, text only, horizontal
LinkBarTextVer(1)the dynamic link bar, text only, vertical
DateCurnocurrent date
DateLastChangenodate of the last change of the page
EditBarnooptionally used together with a horizontal link bar
SearchFormnosmall search form that can be used on any page
WikiNameyesused for the meta tags, naming the browser window and bookmarks, same result as {Insert:SiteName}
WikiCopyrightnodisplays the copyright text, same result as from {Insert:WikiCopyright}
LogoFilenoinserts the image defined in the configuration variable LogoUrl
LogoDecnoinserts the image defined in the configuration variable LogoUrl, the image links to the front page of the wiki (or to the edit command if you are an admin, handy for wikis without a link bar like WikiWeb:action=FrontPage)

(1) ... one of this group of insertion markers is needed.

Insertion markers may be used more than once within a single template (e. g. the link bar is sometimes used at the top and at the bottom of the page).

Self-defined insertion variables

By using markers like {Insert:VariableName[;optional default value]} one can use any variable that is known to the script or that is defined in an configuration file or context page.

Such self-defined variables are useful e. g. to hold definable colors, widths of lines, width of tables, ... whatever you want.

Comments and Questions

AndriusKulikauskas February 28, 2009 18:42 CET Helmut, I see that {PageText} gives the HTML marked up output. Is there an insertion variable with just the text, which could be used for edit templates?

Andrius, no, currently there is not. But it should be a one-liner to add a new insertion marker and make it functional the way you want. Search the script for the insertion marker "{PageText}", and add line something like:

  $ret =~ s/{RawText}/PageRetText($id);/e;

which should do the job. -- HelmutLeitner March 4, 2009 7:46 CET