Test /
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 '
' that contains the name of the page that is currently being accessed. See PmWiki.Variables for a list of these variables.$pagename
- 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 PageVariables 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 toFmtPageName?()
that specifies a page.
See FmtPageName for more details. - Format variables, e.g., "
$FullName
" and "$PageUrl
" that you can give toFmtPageName?()
and have it interpret the variable for the page name given as the second argument toFmtPageName?()
(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 byFmtPageName()
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.
- Things like "
Test
" and "December 25, 2023, at 08:48 AM
" 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 theMarkup()
sequence, the same as ... or(:include:)
or(:table:)
or any other markup. - 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. - With minor exceptions, basically everything else you see that
looks like
$VarName
is a PHP variable.
Pm