Layout Variables
< I18n Variables | Variables | Link Variables >
Variable substitutions in the skin template are all managed by the FmtPageName()
function from pmwiki.php
. Pmwiki variable substitutions available on pages are managed by the substitutions from stdmarkup.php
or superseded in local/config
files.
:⚠ $ActionSkin:This array is used to override the current skin when performing a given action. The most common use is to set %hlt php%@@$
Action Skin['print']='foo' to use the 'foo' skin when printing, regardless of what the
$Skin
@@ variable is set to.
⚠ $ActionTitleFmt: An array that adds a separator and the current [[PmWiki:AvailableActions|wiki action]] ('edit', 'attr', 'diff', 'upload'...) to the HTML title of the page (the $
Action Title variable in$HTMLTitleFmt
or the skin template). By default it is localized"| action"
, but you can change it-
$ActionTitleFmt['edit'] = ': $[Edit]';
# use a ":" colon separator -
$ActionTitleFmt['edit'] = ' $[Edit] ';
# space separator, may be placed at the start of$HTMLTitleFmt
- %apply=item id=Wiki Title%
$WikiTitle
- A variable which contains the Wiki title as displayed in the browser tab and at the top of the browser window, e.g. "on-line prediction wiki"
- %apply=item id=HTML Title Fmt%
$HTMLTitleFmt
- A variable that overrides the content of the
<title>...</title>
element in the skin template. Here you can set this format without editing the skin template. For example: -
# Page title first, then⚠ $HTMLTitleFmt = '$
Title |⚠ $WikiTitle $
Action Title';⚠ $WikiTitle, then the action e.g. "| Edit", and the wiki group $
Group is omitted. -
# Page title first, then the title of the group landing page, see PageVariables.⚠ $HTMLTitleFmt = '$
Title | $GroupHomePageTitle'; - %apply=item id=Enable Page Title Priority%
$EnablePageTitlePriority
- A variable defining how to treat multiple
(:title ...:)
page directives (added in Pm Wiki 2.2.9). -
# Pm Wiki default, last encountered title wins (the title may be changed from included pages or Group Footer).$EnablePageTitlePriority
= 0; -
# First title wins; if a title is defined in the page, directives from included pages cannot change it.$EnablePageTitlePriority
= 1; - %apply=item id=Enable Diff Inline%
$EnableDiffInline
- If set to 0, this variable switches off the word-level highlighting on the markup in the page history.
-
# Disable colors, show plain text differences$EnableDiffInline
= 0; - %apply=item id=Enable RC Diff Bytes%
$EnableRCDiffBytes
- If set to 1,
(All)Recent Changes
pages will display the difference in bytes of the page content from the previous version like (+123) or(-42) -
# Show bytes difference from previous version$EnableRCDiffBytes
= 1; - The colors are the same as those in the page history; if your skin doesn't provide them, add to
pub/css/local.css
something like:.diffmarkup { font-family: monospace; font-size: 0.9em; } .diffmarkup del { background: #ff9; text-decoration: none; } .diffmarkup ins { background: #9f9; text-decoration: none; }
:⚠ $CurrentTime: This variable contains the current date and time formatted with $
Time Fmt. It is used in Recent Changes
(before 2.3.0), and in user signatures.
:⚠ $CurrentLocalTime: This variable contains the current date and time stamp, saved in @@RecentChanges@@ (since 2.3.0). This time stamp will be saved in the wiki source text in Greenwich Mean Time (UTC/GMT), but will be shown according to $
Time Fmt in the timezone of the wiki. When ⚠ $EnableLocalTimes is enabled, then it will be shown in the visitor's time zone. The same format is also saved in user signatures if $
Enable Local Times is enabled.
⚠ $EnablePmUtils: This variable controls whether the script @@pub/pmwiki-utils.js@@ should be loaded or not. The script contains JavaScript utility functions for the table of contents, the syntax highlighting, the recent changes, and the email obfuscation, and the dark color theme. By default $
Enable Pm Utils is 1 (enabled), but most functions need to be enabled individually (⚠ $EnableLocalTimes, $
Enable Highlight,⚠ $PmTOC, $
Link Functions['mailto- '],
⚠ $EnableCopyCode, $
Enable Sortable,⚠ $ToggleNextSelector, $
Enable Pm Syntax,⚠ $CustomSyntax, $
Enable Copy Code,$EnableDarkThemeToggle
). Set this variable to 0 to disable all these functions. - %apply=item id=Enable Dark Theme Toggle%
$EnableDarkThemeToggle
- This variable enables the core functions for toggling a dark color scheme, if the skin supports this feature, see Cookbook:DarkColorScheme. Can be set in a skin.php file (as global variable) or in config.php:
-
$EnableDarkThemeToggle
= 0; -
$EnableDarkThemeToggle
= 1; -
$EnableDarkThemeToggle
= 2; -
$EnableDarkThemeToggle
= 3; - See also
$ImgDarkSuffix
. - %apply=item id=Enable Local Times%
$EnableLocalTimes
- (Default disabled) Enables the rewriting of date and time stamps into the timezone of the visitor, see documentation at Cookbook:LocalTimes. Dates affected are in Recent Changes pages, in page histories, and in user signatures.
-
$EnableLocalTimes
= 2; -
$EnableLocalTimes
= 1; -
$EnableLocalTimes
= 3; ⚠ $EnablePmSyntax: (Not to be confused with $
Enable Highlight) When set to 1, enables PmSyntax, a syntax highlighting for the Pm Wiki markup language, which makes the documentation easy to read (from 2.3.0). When set to 2, it also enables the experimental syntax highlighting in the basic edit form-
$EnablePmSyntax = 1; # highlight documentation blocks $EnablePmSyntax = 2; # both documentation and edit form if ($action=='edit') $EnablePmSyntax = 2; # only edit form
- %apply=item id=Custom Syntax%
$CustomSyntax
- (From 2.3.0) An array where custom rules for syntax highlighting can be defined. See documentation at Cookbook:CustomSyntax.
:⚠ $EnableHighlight: (Not to be confused with $
Enable Pm Syntax) If set to 1, enables compatibility with the highlight.js library to highlight program code. In addition, you need to include the library and mark your code blocks with the wikistyle %highlight%
, see WikiStyles#highlight.
- %apply=item id=Enable Copy Code%
$EnableCopyCode
- (From 2.3.21) When set to 1, adds a
[+]
button near the top right of preformatted blocks. A user clicking on the button will have the text of the preformatted block copied to their system clipboard:$EnableCopyCode = 1; # add a [+] copy code button to pre blocks
- %apply=item id=HTML Tag Attr%
$HTMLTagAttr
- A string containing attributes of the
<html...>
tag in the skin template, default empty. For example, to add a "lang" attribute, set inconfig.php
:$HTMLTagAttr = 'lang="en" xml:lang="en"';
- For this variable to work in a custom skin, add it in the template file, for example:
<html xmlns="http://www.w3.org/1999/xhtml" $HTMLTagAttr>
- %apply=item id=HTML Styles Fmt%
$HTMLStylesFmt
- An array of CSS statements to be included in the page's output along with other HTML headers. This array provides an easy place for scripts to add custom CSS statements.
- %apply=item id=HTML Header Fmt%
$HTMLHeaderFmt
- An array of HTML text to be included in the page's
<head>
section, at the point where the skin template specifies a<!--HTMLHeader-->
directive. This array provides an easy place for scripts to add custom HTML headers.
$HTMLHeaderFmt['favicon'] = '<link href="http://path/to/icon.png" type="image/png" rel="icon" /> <link href="http://path/to/icon.ico" type="image/x-icon" rel="shortcut icon" />';
$HTMLHeaderFmt['rss'] = '<link rel="alternate" type="application/rss+xml" title="Rss All recent Changes" href="$ScriptUrl/Site/AllRecentChanges?action=rss" />';
$HTMLHeaderFmt['the-javascript'] = '<script> // the javascript code </script>';
:⚠ $HTMLFooterFmt:Like $
HTML Header Fmt above, this contains an array of HTML text to be included near the end of an HTML document, at the point where the skin template specifies a <!--HTMLFooter-->
directive (usually just before a closing </body>
tag). Primarily used by scripts to add custom HTML output after the body of the page output.
:⚠ $MetaRobots:Sets the value of the %hlt php%<code class='escaped'><meta name='robots' ... /></code> tag generated by PmWiki to control search engine robots accessing the site. PmWiki's default setting tells robots to not index anything but the normal page view, and to not index pages in the PmWiki [[wiki group]]. Explicitly setting $
Meta Robots overrides this default.
# never index this site $MetaRobots = 'noindex,nofollow'; # disable the robots tag entirely $MetaRobots = '';
- %apply=item id=Messages Fmt%
$MessagesFmt
- An array of HTML text to be displayed at the point of any
(:messages:)
markup. Commonly used for displaying messages with respect to editing pages. - %apply=item id=Recent Changes Fmt%
$RecentChangesFmt
- An array specifying the format of the Recent Changes listing.
$RecentChangesFmt['$SiteGroup.AllRecentChanges']
'* [[{$Group}.{$Name}]] . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]'
. . .
). The two spaces separate two parts of the format: the first part doesn't change (e.g. a link to the changed page) and the second part does change (e.g. the date and author of the change). Upon saving a page, Pm Wiki removes a line that matches the first part and adds a line with the current format before the first line with 2 spaces. This way, any line without two consecutive spaces stays at the top of the recent changes page.
$RecentChangesFmt['$SiteGroup.AllRecentChanges'] = '* [[{$Group}.{$Name}]] . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]'; $RecentChangesFmt['$Group.RecentChanges'] = '* [[{$Group}/{$Name}]] . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]';
⚠ $CurrentLocalTime by default which shows exactly what $
Current Time previously showed, but when $EnableLocalTimes
is set, will rewrite the time and date in the local format and timezone of the visitor.
:⚠ $RecentUploadsFmt:An array specifying the format for uploaded files at the RecentChanges listing. It is similar to $
Recent Changes Fmt. If enabled, newly uploaded files will be logged to the Recent Changes pages. Default is disabled. See Cookbook:RecentUploadsLog for more information. See also $EnableRecentUploads
.
:⚠ $EnableRecentUploads: When set to 1, and when $
Recent Uploads Fmt is not set, it enables Recent uploads in a default format, only on the page Site.All Recent Changes. This was added in 2.3.0 to easily enable the feature with some default settings that may be good enough for many wikis.
- %apply=item id=Draft Recent Changes Fmt%
$DraftRecentChangesFmt
- An array specifying the format of the Recent Changes listing when saving Draft pages.
⚠ $RecentChangesFmt is set to $
Draft Recent Changes Fmt when a Draft page is saved. For example, you could save drafts in a separate Recent Draft Changes page and not list in the normal group's Recent Changes page:
$DraftRecentChangesFmt['$Group.RecentDraftChanges'] = '* [[{$Group}/{$Name}]] . . . $CurrentTime $[by] $AuthorLink: [=$ChangeSummary=]'; $DraftRecentChangesFmt['$Group.RecentChanges'] = '';
- %apply=item id=RC Lines Max%
$RCLinesMax
- The maximum number of lines to be stored in Recent Changes pages. The default is zero, meaning "no limit".
$RCLinesMax
= 1000; # maintain at most 1000 recent changes
- %apply=item id=Page Redirect Fmt%
$PageRedirectFmt
- The text to be used when a page is redirected via the
(:redirect:)
markup.$PageRedirectFmt = '<p><i>redirected from $FullName</p>'; $PageRedirectFmt = '';
- %apply=item id=Wiki Style%
$WikiStyle
- An array which contains the predefined Wiki Styles which can be used on a textpage.
See: PmWiki.CustomWikiStyles - %apply=item id=Wiki Style Apply%
$WikiStyleApply
- An array which defines the scope of wiki styling per HTML element. Default settings are:
'item' => 'li|dt', 'list' => 'ul|ol|dl', 'div' => 'div', 'pre' => 'pre', 'img' => 'img', 'block' => 'p(?!\\sclass=)|div|ul|ol|dl|li|dt|pre|h[1-6]', 'p' => 'p(?!\\sclass=)'
- LI elements using the item keyword
- UL, OL, DL elements using the list keyword
- etc.
* %apply=item red%Here is a red styled list item * This item would not be styled. |
|
- %apply=item id=Wiki Page CSS Fmt%
$WikiPageCSSFmt
- This variable holds a page name where you can add CSS rules applied to specific page patterns (default disabled). See Cookbook:LocalCSS as an example.
-
$WikiPageCSSFmt
= 'Site.Local CSS'; # global Site.Local CSS page -
$WikiPageCSSFmt
= '{$Group}.Local CSS'; # per-group Local CSS pages ⚠ $WikiPageCSSVars: If a "wiki CSS page" is enabled with $
Wiki Page CSS Fmt, this is an array with global PHP $variables available as pre-processor @variables in that page. By default the array contains-
'Farm Pub Dir Url', 'Pub Dir Url', 'Skin', 'action', 'Skin Dir Url'
. ⚠ $EnableSelfWikiPageCSS: If a "wiki CSS page" is enabled with $
Wiki Page CSS Fmt, that specific page doesn't have CSS applied to itself when browsed or edited. In case a grave mistake is made in the styles and the site becomes unusable, this page will still be viewable and editable. People familiar with CSS can set this to 1 and the styles will be applied to the page itself, also in "Preview" mode-
$EnableSelfWikiPageCSS
= 1; # Apply styles to the "wiki CSS page" itself - %apply=item id=Pm TOC%
$PmTOC
- Enable and configure the built-in table of contents, see Table of contents (TOC).
-
$PmTOC
['Enable'] = 1; # Enable TOC; default is 0 (disabled). - %apply=item id=Toggle Next Selector%
$ToggleNextSelector
- A CSS selector to enable interactive toggling of hidden sections, see Cookbook:ToggleNext. By default it is disabled.
:⚠ $MaxIncludes:Controls the number of times that pages can be included via the %pmhlt%<code class='escaped'>(:include:)</code> and other directives, used to control recursion and otherwise pose a sanity check on page contents. $
Max Includes defaults to 50, but can be set to any value by the wiki administrator.
$MaxIncludes = 50; # default $MaxIncludes = 1000; # allow lots of includes $MaxIncludes = 0; # turn off includes
:⚠ $Skin:Lists the name(s) of skins to load, unless overridden by $
Action Skin. Normally $Skin
contains a single string which is the name of a skin directory, but it may also be an array of names, in which case the first skin found from the list is used.
- %apply=item id=Skin Dir Url%
$SkinDirUrl
- Set by
scripts/skins.php
to be the base url of the current skin's directory (i.e., within a 'pub/skins/
' directory). This variable is typically used inside of a skin.tmpl
file to provide access to.css
files and graphic images associated with the skin. - %apply=item id=Skin Lib Dirs%
$SkinLibDirs
- An array which, given the filesystem path (array key) to a skin (or a directory containing several skins), provides the corresponding URL (array value).
skin.tmpl
and skin.php
files, as seen by the Pm Wiki program. It does not have to be publicly accessible.
.css
, .gif
, and other files which appear in the HTML code sent by PM Wiki to the browser. This directory must be publicly accessible.
$SkinLibDirs
is set to:
$SkinLibDirs = array( "./pub/skins/\$Skin" => "$PubDirUrl/skins/\$Skin", "$FarmD/pub/skins/\$Skin" => "$FarmPubDirUrl/skins/\$Skin");
- %apply=item id=Skin Template Include Level%
$SkinTemplateIncludeLevel
- how many levels of inclusion are allowed for skin templates with the
<!--IncludeTemplate:...-->
directive. By default this directive is disabled. Setting it to 1 allows one level of inclusions, setting it to 2 allows included templates to include more templates. There can be up to 10 levels of inclusion. This variable can be defined either inlocal/config.php
or inpub/skins/skinname/skinname.php
(with SDV):# in config.php, allow one level of inclusions $SkinTemplateIncludeLevel = 1; # in skinname.php, allow 3 levels of inclusions SDV($GLOBALS['SkinTemplateIncludeLevel'], 3);
- %apply=item id=Page Logo Url%
$PageLogoUrl
- is the url that refers to a logo image which most skins display somewhere in the page's header (top left usually), e.g. ""
- %apply=item id=Enable Path Info%
$EnablePathInfo
- Changes the handling of the page URL. When set to
1
page URL will be...wiki.php/Main/Main
, when set to0
(default) it will be...wiki.php?n=Main.Main
.
:⚠ $EnableFixedUrlRedirect:When PmWiki is given a partial page name (e.g., just the name of a WikiGroup), it uses $
Page Path Fmt in order to make a complete page name from the partial one, then issues a "redirect" to the browser to tell it to reload the page with the correct full page name. Setting
blocks the redirect, so that Pm Wiki continues processing with the adjusted page name rather than issuing the redirect.
$EnableFixedUrlRedirect
=0;
- %apply=item id=Group Header Fmt%
$GroupHeaderFmt
- Defines the markup placed at the top of every page. Default value is:
$GroupHeaderFmt = '(:include {$Group}.GroupHeader self=0 basepage={*$FullName}:)(:nl:)';
- %apply=item id=Group Print Header Fmt%
$GroupPrintHeaderFmt
- Defines the markup placed at the top of every page when
action=print
. Default value is:
SDV($GroupPrintHeaderFmt,'(:include $Group.GroupPrintHeader basepage={*$FullName}:)(:nl:)');
- %apply=item id=Group Footer Fmt%
$GroupFooterFmt
- Defines the markup placed at the bottom of every page. Default value is:
$GroupFooterFmt = '(:nl:)(:include {$Group}.GroupFooter self=0 basepage={*$FullName}:)';
- %apply=item id=Group Print Footer Fmt%
$GroupPrintFooterFmt
- Defines the markup placed at the bottom of every page when
action=print
. Default value is:
SDV($GroupPrintFooterFmt,'(:nl:)(:include $Group.GroupPrintFooter basepage={*$FullName}:)');
- %apply=item id=Page Not Found Header Fmt%
$PageNotFoundHeaderFmt
- Specifies the HTTP header to send when attempting to browse a page that doesn't exist. Some webserver packages (notably Microsoft's "Personal Web Server") require that this variable be changed in order to work.
# default $PageNotFoundHeaderFmt = 'HTTP/1.1 404 Not Found'; # return all pages as found $PageNotFoundHeaderFmt = 'HTTP/1.1 200 Ok';
$PageNotFoundHeaderFmt
MUST be set to return 200 as described above in order to get the expected behaviour with all browsers.
- %apply=item id=HTMLV Space%
$HTMLVSpace
- Setting
$HTMLVSpace = '';
in a local customizationfile (e.g.,local/config.php
) prevents insertion of spacer paragraphs (<p class='vspace'></p>
) in generated HTML code. To limit this change to a single skin, place the$HTMLVSpace = '';
statement in askin.php
file, preceded by the statementglobal $HTMLVSpace;
.
:⚠ $HTMLPNewline:This variable allows to enable linebreaks by default, i.e. without having the directive %pmhlt%<code class='escaped'>(:linebreaks:)</code> in a page or in a GroupHeader. To enable line breaks, add to @@config.php@@ such a line:<br /> %hlt php%@@$
HTMLP Newline = '<br/>'; @@
:⚠ $SimpleTableDefaultClassName:This variable can contain a CSS classname to be used for [[tables|simple tables]], if a "class=" attribute is not defined in the wiki page (default unset):<br />%hlt php%@@ $
Simple Table Default Class Name = "wikisimpletable";@@
See for sample code PITS:00638.
:⚠ $EnableSimpleTableRowspan:If set to 1, will enable features replicating the recipe Cookbook:RowspanInSimpleTables (default disabled).<br />@@ $
Enable Simple Table Rowspan = 1; @@ # See recipe
- %apply=item id=Enable Sortable%
$EnableSortable
- Set this variable to 1 to enable sortable tables, see Tables#sortable (default disabled):
$EnableSortable = 1; # Enable sortable tables
:⚠ $TableCellAttrFmt:For [[Tables]], defines the HTML attributes given to each @@<td>@@ or @@<th>@@ cell in the output. Can contain references to $
Table Cell Count which holds the horizontal column number of the current cell.
:⚠ $TableCellAlignFmt:For [[Tables]], defines the HTML attributes for alignment of each @@<td>@@ or @@<th>@@ cell. Default is @@" align='%s'"@@ where %s will be replaced with 'center', 'left' or 'right'. For a valid HTML5 output you may want to change this in @@config.php@@:<br />%hlt php%@@$
Table Cell Align Fmt = " class='%s'";@@
then define the CSS classes td.center, td.right and td.left (also th).
:⚠ $TableRowAttrFmt:For [[Tables]], defines the HTML attributes given to each @@<tr>@@ element in the output. Can contain references to $
Table Row Count to give the absolute row number within the table, or ⚠ $TableRowIndex to provide a repeating row index from 1 to $
Table Row Index Max.
# Give each row a unique CSS class based on row number (tr1, tr2, tr3, ... ) $TableRowAttrFmt = "class='tr\$TableRowCount'"; # Give each row alternating CSS classes (ti1, ti2, ti1, ti2, ti1, ... ) $TableRowIndexMax = 2; $TableRowAttrFmt = "class='ti\$TableRowIndex'";
:⚠ $TableRowIndexMax:The maximum value for $
Table Row Index in Tables.
# Set rows indexes as 1, 2, 3, 1, 2, 3, 1, 2, ... $TableRowIndexMax = 3;
- %apply=item id=Enable Table Auto Valign Top%
$EnableTableAutoValignTop
- Advanced tables are intended for layout, and automatically insert the
valign='top'
attribute if there is novalign
attribute defined in the markup source. Setting this variable to 0 in config.php will prevent the automatic addition.
$EnableTableAutoValignTop
= 0; # disable automatic valign='top' attr
:⚠ $EnableAutoSkinList:This variable enables the change of the [[PmWiki/skins|skin]] from the URL to any skin available on the wiki installation. See also $
Page Skin List and Skins:SkinChange.
:⚠ $PageSkinList:This is an array of allowed skins that can be changed by the visitor with @@?skin=@@ or @@?setskin=@@ URL query to the wiki. See also $
Enable Auto Skin List and Skins:SkinChange.
- %apply=item id=Trail Fmt%
$TrailFmt
- An array of HTML snippets containing the layout of the WikiTrails output. If you define one or more custom values in config.php, they will be used. Here are the default values:
$TrailFmt['<<|'] = "<span class='wikitrail'><< \$prev | \$trailname | \$next >></span>"; $TrailFmt['<|'] = "<span class='wikitrail'>\$prev\$trailname\$next</span>"; $TrailFmt['^|'] = "<span class='wikitrail'>\$crumbs</span>";
:⚠ $TrailPathSep: the trail separator of the "path" trail ( %pmhlt%<code class='escaped'>^|[[TrailIndexPage]]|^</code> ). For instance @@$
Trail Path Sep = ' > ';@@ will output "TrailIndexPage > TrailPage2 > TrailPage4".
- %apply=item id=Input Label Fmt%
$InputLabelFmt
- A HTML snippet containing the layout of the "label" after an input form field. If you define a custom value in config.php, it will be used. The default value has initial and trailing spaces:
$InputLabelFmt = ' <label for="$LabelFor" $LabelTitle>$LabelText</label> ';
⚠ $FmtV['$
Table Cell Count']- PM Wiki internal variable - Horizontal column number of the current cell. For use in
⚠ $TableCellAttrFmt and $
Table Row Attr Fmt. Administrators can use in⚠ $TableCellAttrFmt and/or $
Table Row Attr Fmt.
⚠ $TableCellAttrFmt = 'class=col\$
Table Cell Count';
⚠ $FmtV['$
Table Row Count']- PM Wiki internal variable - Current row number. Administrators can use in
⚠ $TableCellAttrFmt and/or $
Table Row Attr Fmt.
Table Row Attr Fmt = "class='row\$TableRowCount'";
⚠ $FmtV['$
Table Row Index']- PM Wiki internal variable - Row index number derived from
⚠ $TableRowIndexMax. (1,2,3,1,2,3,...). Administrators can use in $
Table Cell Attr Fmt and/or$TableRowAttrFmt
.
⚠ $TableRowAttrFmt = "class='ind\$
Table Row Index'";
See also: Edit Variables
< I18n Variables | Variables | Link Variables >
This page may have a more recent version on pmwiki.org: PmWiki:LayoutVariables, and a talk page: PmWiki:LayoutVariables-Talk.