VariablesAndFriends


This page discusses the difference between PHP variables and other things that appear with a '$' in front of them in the PmWiki system.

There is a bit of confusion because there are four different entities that appear in a PmWiki system that are preceded by a dollar sign ($):

PHP variables (e.g. $pagename)
These are variables as used by the PHP programming language. A very common example is the variable '$pagename' that contains the name of the page that is currently being accessed. See PmWiki.Variables for a list of these variables.
Markup variables (e.g. Test)
These are really a special form of markup. A string such as Test can be used in wiki source to be replaced by the name of the current group when the page is shown. See PmWiki.MarkupVariables for more details on these "variables".
Format variables (e.g. $FullName)
These are special strings that are used by FmtPageName to perform substitions. To be specific, the "format variables" may appear in the first argument to FmtPageName?() where they are interpreted as a function of the second argument to FmtPageName?() that specifies a page.
See FmtPageName for more details.
> * Format variables, e.g., "$FullName" and "$PageUrl" that you can > give to FmtPageName() and have it interpret the variable for the > page name given as the second argument to FmtPageName() (which may > have nothing to do with the "current" page as the browser sees it).
Language substitions (e.g. phrase???)
These are phrases that may be replaced depending on what language PmWiki is using. If PmWiki is instructed to use Swedish for instance, it will see ???where?? if a Swedish version the phrase exists and replace the phrase with the translated version. This is also done by FmtPageName()
  See FmtPageName for more details.

And here's something from the mouth of pm:

 
As far as keeping thing straight for those who need to understand
the differences, there are really only three things to know.  

1.  Things like "{$Group}" and "{$LastModified}" are *markup*.  
    You can call them "variables" or "markup variables" if it pleases 
    you, but they don't really exist as variables anywhere in the 
    PmWiki code, nor is there an enforced correspondence between them
    and any PHP variable.  They're just substitutions in the Markup() 
    sequence, the same as [=... or (:include:) or (:table:) or 
    any other markup.

2. A limited set of $-substitutions -- basically anything that

    corresponds to a page attribute -- are not PHP variables and 
    are only available through the FmtPageName?() subroutine.  
    The complete set of these special substitutions is $Group, 
    $Name, $FullName, $PageUrl, $Title, $Titlespaced, $Namespaced, 
    $Groupspaced, $LastModifiedBy, $LastModifiedHost, and $LastModified.  
    These items cannot just be standard PHP variables because often
    PmWiki needs to obtain the url, name, group, title, etc. of a page 
    other than the one currently being viewed by a browser.

3. With minor exceptions, basically everything else you see that

    looks like $VarName is a PHP variable.

Pm =]

 0: 00.00 00.00 config start
 1: 00.01 00.00 config end
 2: 00.11 00.11 MarkupToHTML begin
 3: 00.17 00.16 MarkupToHTML end
 4: 00.18 00.17 MarkupToHTML begin
 5: 00.19 00.18 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
 6: 00.20 00.18 ReadApprovedUrls SiteAdmin.ApprovedUrls end
 7: 00.20 00.19 MarkupToHTML end
 8: 00.20 00.19 MarkupToHTML begin
 9: 00.21 00.19 MarkupToHTML end
10: 00.21 00.19 now
Peak memory: 3,573,032 bytes