blob: e87f7c44c61ab5cb0112759fae8c80fb11e8ea97 [file] [log] [blame]
text=This page describes how a [[WikiAdministrator]] can customize the layout (headers and footers) that appear on [[PmWiki]] pages. Layouts are usually controlled by a "skin" stored in the ''pub/skins/'' directory. A skin is a directory that contains a template file (''something.tmpl'') that defines the layout of pages, as well as any supporting CSS and graphic images needed for the layout.²²For example, PmWiki is distributed with a default skin²called "pmwiki" that is stored in the ''pub/skins/pmwiki/'' directory. This directory contains a ''.tmpl'' file that defines how pages should be displayed on the screen, as well as a CSS file and graphic image needed by the layout.²²If you want to change the layout, you basically have three options.²²* You can make a copy of the ''pmwiki'' skin and modify it.²* You can install a skin from the cookbook -- see Cookbook:Skins for template files and layout designs that others have contributed.²* You can design your own skin from scratch.²²!! Creating or modifying a template²²The basic steps for customizing a layout are to create/edit a skin as a subdirectory of ''pub/skins/'', then set the $Skin variable to the name of your skins subdirectory. ²²The information below will help you with these two steps.²²[[#modifyskin]]²!!! Modifying the "pmwiki" skin²²The pmwiki skin (i.e., ''pub/skins/pmwiki/'') is part of the PmWiki installation, so any changes you make to these files are likely to be overwritten when you upgrade. Thus, instead of editing the files directly, you should start by making a copy of the files in ''pub/skins/pmwiki/'' into a new skins directory (say, ''pub/skins/xyzskin/'').²²Once you've made a copy of the skin directory, you can then edit the ''.tmpl'' and other files in that directory. You then tell PmWiki to use the skin in ''pub/skins/xyzskin'' by setting²² $Skin = 'xyzskin';²²in your ''local/config.php'' file.²[[#modifyskinend]]²²!!! Skin template files²²A template file is basically an HTML file that also contains variable substitutions (indicated by '$') and special directives embedded in HTML comments. Two of these special directives are required in the template file. The directive @@[=<!--PageText-->=]@@ belongs to the <body> section of the HTML document, and tells PmWiki where the main content of each wiki page should be placed. The other required directive is @@[=<!--HeaderText-->=]@@, which goes somewhere in the <head> section of the HTML document.²²Throughout the layout template, variables such as $PageUrl, $ScriptUrl, $Group, and $Title are replaced with the URL of the current page, the base URL to the pmwiki.php script, the name of the current WikiGroup, and the title of the page being displayed. Other variables in the template are substituted with the values of the equivalent PHP global variables. Some other common sequences:²² $SkinDirUrl - the url of the skin's directory² $Namespaced - the name of the page with spaces between words² $Groupspaced - the group of the page with spaces between words²²Finally, the template can contain other directives to output the contents of other pages, files on disk, or to call other PHP functions. The directive @@[=<!--wiki:Main.SomePage-->=]@@ can be used to display the contents of [=Main.SomePage=] at some point within the layout. This is useful to create editable menus or sidebars from pages other than the one currently being displayed. Variable substitutions work here, so @@[=<!--wiki:$Group.SomePage-->=]@@ will display the contents of [="SomePage"=] in the current WikiGroup. Multiple alternatives can also be specified, thus @@[=<!--wiki:$Group.SomePage Main.SomePage-->=]@@ displays the contents of [=SomePage=] in the current group, and if that page doesn't exist then [=Main.SomePage=] is used instead.²²Category: [[!Skins]]²²%trail%<<|PmWiki.DocumentationIndex|>>
agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1