PmWiki.PageVariables 4.6 KB

12345678910111213
  1. version=pmwiki-2.1.11 ordered=1 urlencoded=1
  2. agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
  3. author=Pico
  4. csum=Supplied "as in" example for [@{$ScriptUrl}@]
  5. ctime=1135816487
  6. description=Documentation for "variables" that are associated with pages.
  7. host=12.33.45.37
  8. name=PmWiki.PageVariables
  9. rev=28
  10. targets=PmWiki.FmtPageName,PmWiki.ConditionalMarkup,PmWiki.Variables,PmWiki.MarkupMasterIndex,PmWiki.DocumentationIndex
  11. text=%25audience%25 authors (intermediate)%0a(:title Page-specific Variables:)%0a(:description Documentation for "variables" that are associated with pages. :)%0a[[#desc]]This page describes the "variables" that are associated with pages. Page variables have the form @@{$''variable''}@@, and can be used in page markup or in certain formatting strings in PmWiki. For example, the markup "[@{$Group}@]" renders in this page as "{$Group}".%0a%0aNote that these variables do not necessarily exist in the PHP code, because they have to be determined for a specific page. (However, they are usable in [[FmtPageName]] strings.)%0a%0aThere is also the form @@{''pagename''$''variable''}@@, which returns the value of the variable for another page. For example, "[@{MarkupMasterIndex$Title}@]" displays as "{MarkupMasterIndex$Title}".%0a%0a%0a!! Default page variables%0a%0aThe page variables defined for PmWiki are:%0a%0a->[@{$Group}@] - page's group name, as in "`{$Group}"%0a->[@{$Groupspaced}@] - spaced group name, as in "{$Groupspaced}"%0a->[@{$DefaultGroup}@] - default group name, as in "{$DefaultGroup}"%0a->[@{$SiteGroup}@] - default group name for e.g. RecentChanges, as in "{$SiteGroup}"%0a->[@{$Name}@] - page name, as in "`{$Name}"%0a->[@{$Namespaced}@] - spaced page name, as in "{$Namespaced}"%0a->[@{$DefaultName}@] - name of default page, as in "`{$DefaultName}"%0a->[@{$FullName}@] - page's full name, as in "`{$FullName}"%0a->[@{$Title}@] - page title (may differ from Name), as in "{$Title}"%0a->[@{$Titlespaced}@] - title/spaced page name, as in "{$Titlespaced}"%0a->[@{$Description}@] - page's description from the [@(:description:)@] markup, as in "{$Description}"%0a%0a->[@{$LastModified}@] - date page was edited, as in "{$LastModified}"%0a->[@{$LastModifiedBy}@] - page's last editor, as in "{$LastModifiedBy}"%0a->[@{$LastModifiedHost}@] - IP of page's last editor, as in "{$LastModifiedHost}"%0a->[@{$LastModifiedSummary}@] - Summary from last edit, as in "{$LastModifiedSummary}"%0a-->%25note%25 Note: Enclose [@{$LastModifiedSummary}@] with [@[=@] and [@=]@] to avoid having PmWiki process any markup that may be contained in the summary.%0a%0a->[@{$PageUrl}@] - page's url, as in "{$PageUrl}"%0a->[@{$Action}@] - page's url action argument, as in "{$Action}"%0a%0aIn addition to the above, there are some page-invariant variables available through this markup:%0a%0a->[@{$Author}@] - the name of the person currently interacting with the site, as in "{$Author}"%0a->[@{$AuthId}@] - current authenticated id, as in "{$AuthId}" %25red%25Please note the lower case 'd'. [@{$AuthID}@] returns nothing%0a%0a->[@{$Version}@] - PmWiki version, as in "{$Version}"%0a->[@{$VersionNum}@] - The internal version number, as in "{$VersionNum}"%0a->[@{$ScriptUrl}@] - The url to the pmwiki script, as in "{$ScriptUrl}"%0a%0a%0a!! Custom page variables%0a%0aYou may add custom page variables as a local customization. In a local configuration file or a recipe script, use the variable $FmtPV:%0a%0a->[@%0a$FmtPV['$VarName'] = "'variable definition'";%0a$FmtPV['$CurrentSkin'] = '$GLOBALS["Skin"]';%0a@]%0a%0aDefines new Page Variable of name $CurrentSkin, which can be used in the page with [@{$CurrentSkin}@] (also for [[Conditional markup]]). It's necessary to use the single quotes nested inside double-quotes as shown above (preferred) or a double-quoted string nested inside single-quotes like ''[@'"this"'@]''.%0a%0aMaking a [@{$WikiTitle}@] markup doesn't quite follow the formula above. Instead you need to use%0a%0a->[@%0a$FmtPV['$WikiTitle'] = '$GLOBALS["WikiTitle"]';%0a@]%0a%0a!! See also%0a%0a* [[Cookbook:More custom page variables]]%0a* [[PmWiki.Variables]] — about variables internal to PmWiki.%0a* [[PmWiki.MarkupMasterIndex]] — complete list of PmWiki markups.%0a%0a%25trail%25 %3c%3c|[[Documentation Index]]|>>%0a>>faq%3c%3c [[#faq]]%0a%0aQ:Is there a variable like $LastModified, but which shows me the creation time?%0aA:No, but you can create one in config.php. For instance:%0a->[@# add page variable {$PageCreationDate} in format yyyy-mm-dd%0a$FmtPV['$PageCreationDate'] = 'strftime("%25Y-%25m-%25d", $page["ctime"])';@]%0a
  12. time=1151078524
  13. title=Page-specific Variables