phpgtk__legacy/wiki1/wikilib.d/PmWiki.LayoutBasics

9 lines
3.3 KiB
Text

version=pmwiki-0.6.15
newline=²
text=->%note% This page is being updated to reflect the new layout scheme used in pmwiki versions 0.6.1 and later. Versions of PmWiki prior to 0.6.0 may want to look [[PmWiki:CustomHeadersAndFooters5 here]].²²This page describes how a WikiAdministrator can customize the layout (headers and footers) that appear on PmWiki pages. As of PmWiki 0.6.1, the layout is usually controlled by a "template file" stored in the ''pub/skins/'' directory. PmWiki is distributed with a default "pmwiki" skin template file in ''pub/skins/pmwiki/pmwiki.tmpl''. To customize the layout, you simply create a new template file and then add a line such as²² $PageTemplateFmt = "pub/skins/myskin/myskin.tmpl";²²to your ''local/config.php'' file.²²->%note% See Cookbook:Skins for template files and layout designs that others have contributed.²²!!!Creating or modifying a template²²To customize a layout, you can either create a new template file from scratch, or you can modify an existing template file. If you want to use one of the files that came with PmWiki as your starting point, you should make a copy of the file and work from the copy instead of editing the original, or your modifications may be lost when {{upgrad|es}}ing PmWiki. Don't forget to set the value of $PageTemplateFmt to point to your new template file in ''local/config.php''.²²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:²² $Titlespaced - the title 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.²²%trail%<<|PmWiki.DocumentationIndex|>>
time=1081007690
author=J Courant
name=PmWiki.LayoutBasics
host=213.101.235.131
agent=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20040130 Firebird/0.7
rev=15