As described in the LayoutBasics
page, HTML based templates can be used to customize the layout and appearance of Wiki pages. Template files can include links to external stylesheets (.css files). This page explains how template files are processed and how CSS files are included.
Templates: Directives and Variables
HTML comments can be included in templates, for example: <!-- this is a comment -->. Some comments work as directives that have special significance. There are no spaces between the comment delimeters and the keywords; that is,
is valid, but
<!-- PageText -->
is not. Available directives and variables are:
- This indicates where the content of the current Wiki page should be inserted.
Include a Wiki page: <!--wiki:Main.SomePage-->
- This directive allows Pm Wiki to insert appropriate meta tags into the <head> section of the HTML output (used to control indexing by search engines). PmWiki will also check for the existence of relevant CSS files in pub/css; $Group.css and $Group.$Title.css will be included here if they exist.
Call a PHP function: <!--function:SomeFunction ''arguments''-->
- Use this type of directive to include a Wiki page. For example, if you have a sidebar, you could include it using <!--wiki:Main.SideBar-->.
- You could use this to call a function you defined in your local/config.php which may print out different text based on, say, the current page or group. The function receives full page name (ex. PmWiki.LayoutAdvanced) and the text following function name (which is optional and can be omitted).
- A directive in this form (ie. starting with "Page" and ending with "Fmt") indicates the beginning of a section of the template. The section that follows is placed in a variable by the same name. For example, <!--PageFooterFmt--> indicates the start of a footer which is stored in the
$PageFooterFmt variable. The section continues until the next <!--Page...Fmt--> directive, or the end of the file. It is also possible to indicate the end of a section using <!--/Page...Fmt-->. Note that, by default, only
$PageTitleFmt are included in the output when a Wiki Page is viewed. Other variables can be defined and used, but they will only appear in certain situations. For example, <!--/PageEditFmt--> can be used to define a section that only appears when the Edit action is in use (ie. a page is being edited).
<< Layout Basics | PmWiki.Documentation Index | Per Group Customizations >>
- PHP variables are evaluated when PmWiki processes a template file. For example, you can insert a logo using $PageLogoFmt, or create an Edit Page link using <a href='$PageUrl?action=edit'>$[Edit Page]</a>