Apolyton CTP2 forums
Apolyton CTP2 archives
Source Code Project SVN
||Search the Wiki:|
PagesRecent Changes Search
Create a new page:
AE Modding Wiki : PmWiki : PageTextVariables
Page text variables are string variables created in the wiki text of a page, and can be automatically made available for inclusion in other pages. In the default installation, PageTextVariables can only have a name containing basic Latin/Roman (ASCII) letters, digits, dash and underscore. This is a limitation for international wikis (experimental recipe for international PTV : Cookbook:InternationalPTVs).
Defining Page Text Variables
There are three ways to define automated Page Text Variables (more patterns can be defined if needed) :
This creates a new variable that can be accessed by
This creates the
This creates the
Default values for unset or empty Page Text Variables
If a page text variable is not defined in a page, or if the current visitor doesn't have read permissions for the page containing the variable definition, then the markup to access the variable like
An administrator can define default values for such cases (PmWiki 2.2.121+). The following arrays can be defined in local/config.php:
In the above examples,
The patterns are processed in order, and the first matching pattern assigns the value to the variable. The asterisk
Usage on the same page
On the same page you can resolve page text variables through the
Usage in headers and footers: special references
If you want a GroupHeader, GroupFooter, SideBar?, etc to call on page text variable in the main page, you need to include special reference information.
To explicitly reference the page text variable from the page being displayed add an asterisk to the page text variable's markup:
To include a page text variable from a header or footer see usage from other pages below.
Usage from other pages
If you want to pull the data from another page, use the
Usage from included pages
Usage with pagelists
Page lists can also access the page text variables:
Page lists can also use page text variables to select pages :
lists pages having '$:City' set to 'Paris'.
'quotes' must surround all the selections.
The page text variable value is always the text that is written in the page. It is only evaluated when the variable is printed/output to HTML. To sort by a page text variable variable, all values in all pages are the not-yet-evaluated text strings, and the pagelist order function does what it can with them. It does not process/evaluate the text at this point.
An alternative is writing in the wiki page:
as the markup expression that follows won't work:
Testing if set or not set within a pagelist
Use page text variable in a template
Display pages by Audience page text variable.
Use page text variables in conditional markup
Page text variables will be assigned/evaluated before any conditional markup is evaluated. This effectively means that you cannot declare a PTV within an if...else condition; and also that a PTV will have a value even if it is set within a
Usage - from within code (developers only)
It works by caching all page (text) variables it finds in a page (in
Page last modified on October 30, 2019, at 10:13 AM
|AE Modding Wiki built with PmWiki Design: BureauBert|