PmWiki / CustomHeadersAndFooters

This page describes how you can change the default headers and footers that appear on PmWiki pages. Setting the headers and footers is usually done by changing the value of variables in the local.php file (described in InitialSetupTasks and LocalCustomizations).

This page is being updated to reflect the new variable structure used in pmwiki-0.5 and later. Versions of PmWiki prior to 0.5 may want to look here.

The basic appearance of a page in PmWiki is controlled by the $PageHeaderFmt and $PageFooterFmt variables. $PageHeaderFmt specifies the HTML markup to be output after the HTML <body> tag but before the contents of the wiki page itself. $PageFooterFmt specifies the HTML markup after the contents of the wiki page but before the closing </body> tag. To change the page layout to contain only a simple title at the top and an "Edit Page" link at the bottom, one could do (in local.php):

    $PageHeaderFmt = '<h1>$Title</h1><hr />';
    $PageFooterFmt = '<hr /><small><a href="$PageUrl?action=edit">Edit
      Page</a></small>';
Both of these variables (and most PmWiki variables ending in 'Fmt') are processed for global $-variable substitutions prior to being output. Thus, $Title and $PageUrl in the above statements will be replaced with the title of the page and the URL of the page when the values are output.

$PageHeaderFmt and $PageFooterFmt also allow the HTML output to come from a file on disk, an administrator-defined PHP function, or another wiki page. For example, one can create a file called local/myheader.html with the markup for the HTML page header, and then include the contents of that file as the header by specifying

    $PageHeaderFmt = 'file:local/myheader.html';
Other examples include:
    $PageHeaderFmt = 'file:local/myheader.php';    # include a php file
    $PageHeaderFmt = 'function:MyHeaderFunction';  # a user-defined function
    $PageHeaderFmt = 'wiki:$Group.PageHeader';     # a per-group PageHeader wiki page 

Finally, any of these variables can be arrays of values to be output, allowing combinations of the above. For example
    $PageHeaderFmt = array(
      '<h1>$Group.$Title</h1><table><tr><td width="20%">',
      'wiki:$Group.LeftMenu',
      '</td><td>');
    $PageFooterFmt = '</td></table>';
will display a page with the group name and title at the top, followed by a two-cell HTML table with the contents of the LeftMenu page in the left cell and the contents of the wiki page in the right cell.

See PageLayout for more details about the organization and structure of pages produced by PmWiki.


Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /export/vol2/unix/t/templar/www.tempsoft.se/index.php on line 668

Warning: Invalid argument supplied for foreach() in /export/vol2/unix/t/templar/www.tempsoft.se/index.php on line 678
<< ChangePmWikiURL | PmWiki.DocumentationIndex | PerGroupCustomizations >>


Webmaster - Edit Page - Page Revisions - WikiHelp - SearchWiki - RecentChanges
Page last modified on July 03, 2003, at 02:39 PM