version=pmwiki-2.2.0-beta68 ordered=1 urlencoded=1 agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 author=simon charset=ISO-8859-1 csum=not in trail, deprecated host=202.37.32.2 name=PmWiki.LayoutBasics rev=20 targets=PmWiki.SkinTemplates,PmWiki.WikiAdministrator,PmWiki.PmWiki,Category.Skins text=(:Summary:Deprecated, see [[PmWiki/Skin Templates]]:)%0a-> %25note%25 This page is obsolete and here for historical purposes (although it may still be useful) -- see [[PmWiki.SkinTemplates]] for the more recent version.%0a%0a%0a%0aThis page describes how a [[Wiki Administrator]] 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.%0a%0aFor example, [[PmWiki]] is distributed with a default skin%0acalled "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.%0a%0aIf you want to change the layout, you basically have three options.%0a%0a* You can make a copy of the ''pmwiki'' skin and modify it.%0a* You can install a skin from the cookbook -- see [[Cookbook:Skins]] for template files and layout designs that others have contributed.%0a* You can design your own skin from scratch.%0a%0aThe 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. %0a%0aThe information below will help you with these two steps.%0a%0a[[#modifyskin]]%0a!! Modifying the "pmwiki" skin%0a%0aThe 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/'').%0a%0aOnce 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%0a%0a->[@$Skin = 'xyzskin';@]%0a%0ain your ''local/config.php'' file.%0a[[#modifyskinend]]%0a%0a!! Skin template files%0a%0aA 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 @@[=%3c!--PageText-->=]@@ belongs to the %3cbody> section of the HTML document, and tells PmWiki where the main content of each wiki page should be placed. The other required directive is @@[=%3c!--HeaderText-->=]@@, which goes somewhere in the %3chead> section of the HTML document.%0a%0aThroughout 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:%0a%0a-> [@%0a$SkinDirUrl - the url of the skin's directory%0a$Namespaced - the name of the page with spaces between words%0a$Groupspaced - the group of the page with spaces between words%0a@]%0a%0aFinally, the template can contain other directives to output the contents of other pages, files on disk, or to call other PHP functions. The directive @@[=%3c!--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 @@[=%3c!--wiki:$Group.SomePage-->=]@@ will display the contents of [="SomePage"=] in the current WikiGroup. Multiple alternatives can also be specified, thus @@[=%3c!--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. @@[=%3c!--file:path/filename.ext-->=]@@ will include an external file in the template. To include some static HTML text associated with the current wikipage, you can do something like @@[=%3c!--file:path/$Name.frag-->=]@@.%0a%0aCategory: [[!Skins]]%0a time=1220217960