Loading...
 
Skip to main content

History: Wiki Argument Variables

Source of version: 60 (current)

Copy to clipboard
            ! Wiki Argument Variables
This syntax represents some variables which can be used in Tiki, like: user, page, itemId. With a simple ((Wiki Syntax)) using double curly brackets around them, (once this preference is enabled in "Editing & Plugins" control panel) you can put them in your wiki syntax enabled text area and have them to become automatically replaced by their actual value anywhere where they are used.

The feature must be set at : Admin (tiki-admin.php) -> Editing and Plugins -> Wiki argument variables

{REMARKSBOX(type="warning" title="Note about parsing of the Argument Variables")}Because of their nature and the ability to be interpreted from the URL the ((Wiki argument variables)) need to be parsed as last, after all the parsing is done. So any argument variable like -+~np~{~/np~{page}}+- will be interpreted inside any wiki plugin (e.g. ((PluginCode))) or wiki syntax. To display a wiki argument variable unparsed you can escape the first bracket using the -+np+- (non parseable) tag: -+~n~np~p~/np~~{~/np~{page}}+-.{REMARKSBOX}

!! Permanent variables
{HTML()}<pre>
<b> &#123;&#123;itemId&#125;&#125;</b>      (on a tracker item)
<b> &#123;&#123;page&#125;&#125;</b>        (on a wiki page)
<b> &#123;&#123;pageid&#125;&#125;</b>      (id from a wiki page; added in Tiki 12.1)
<b> &#123;&#123;user&#125;&#125;</b>        (when a user is logged in)
<b> &#123;&#123;domain&#125;&#125;</b>      (site domain; added in Tiki 12.1)
<b> &#123;&#123;domainslash&#125;&#125;</b> (site domain ending with a slash; added in Tiki 12.1)
<b> &#123;&#123;domainslash_if_multitiki&#125;&#125;</b> (only when in a multitiki installation, <br/>                 site domain ending with a slash;<br/>                 if the page doesn't belong to a multitiki installation,<br/>                 nothing is returned; added in Tiki 12.1)
<b> &#123;&#123;lastVersion&#125;&#125;</b> (last version of the wiki page; added in Tiki 12.2)
<b> &#123;&#123;lastAuthor&#125;&#125;</b>  (last editor of the wiki page; added in Tiki 12.2)
<b> &#123;&#123;lastModif&#125;&#125;</b>   (last modification date, in short format, <br/>                 of the wiki page; added in Tiki 12.2)
<b> &#123;&#123;lastItemVersion&#125;&#125;</b> (last version of the tracker item <br/>                 indicated in the url; added in Tiki 12.2)
<b> &#123;&#123;lastItemAuthor&#125;&#125;</b> (last editor of the tracker item <br/>                 indicated in the url; added in Tiki 12.2)
<b> &#123;&#123;lastItemModif&#125;&#125;</b> (last modification date, in short format, <br/>                 of the tracker item indicated in the url; added in Tiki 12.2)
<b> &#123;&#123;lastApprovedVersion&#125;&#125;</b> (last approved version of the wiki page<br/>                 when revision approval is on; added in Tiki 12.3)
<b> &#123;&#123;lastApprover&#125;&#125;</b> (last approver of the wiki page<br/>                 when revision approval is on; added in Tiki 12.3)
<b> &#123;&#123;lastApproval&#125;&#125;</b> (last approval date, in short format, of the wiki page<br/>                 when revision approval is on; added in Tiki 12.3)
<b> &#123;&#123;currentVersion&#125;&#125;</b> (current version being displayed of the wiki page<br/>                 when revision approval is on; added in Tiki 14.0)
<b> &#123;&#123;currentVersionApprover&#125;&#125;</b>  (approver of the current version being displayed<br/>                 when revision approval is on; added in Tiki 14.0)
<b> &#123;&#123;currentVersionApproval&#125;&#125;</b>   (approval date, in short format, of the current version being displayed<br/>                 when revision approval is on; added in Tiki 14.0)
<b> &#123;&#123;currentVersionApproved&#125;&#125;</b>  (indicate whether current version being displayed of the wiki page<br/>                   is approved or not when revision approval is on; added in Tiki 14.0)
</pre>{HTML}

!!! User variable
~np~{~/np~{user}} will display the user login as per the settings on the log-in control panels. If you enabled "Use email as username" it will display the user email. (this variable value is not synchronised with the display real name options)

!!!! Example
If you put this syntax on a page named "My Profile":
{HTML()}<pre>
* #&#123;&#123;itemId&#125;&#125;
* &#123;&#123;page&#125;&#125;
* &#123;&#123;user&#125;&#125;
* &#123;&#123;domain&#125;&#125;
* &#123;&#123;domainslash&#125;&#125;
</pre>{HTML}

it will produce (assuming you're viewing the page logged in as user admin): 
* #1
* My Profile
* admin
* doc.tiki.org
* doc.tiki.org/

!! Live example
''This:''
{CODE()}
You are currently on the page ID -+~np~{~/np~{pageid|undefined}}+- with the name "''~np~{~/np~{page}}''". Check the [tiki-pagehistory.php?page=Wiki+Argument+Variables&source=0|wiki source]!.
Your username is __~np~{~/np~{user|nothing}}__.
{CODE}

''Renders as:''
You are currently on the page ID -+{{pageid|undefined}}+- with the name "''{{page}}''". Check the [tiki-pagehistory.php?page=Wiki+Argument+Variables&source=0|wiki source]!.
Your username is __{{user|nothing}}__.

!! User defined variables
When this option is active, it is possible to show the value of variables passed by argument on the URL. Note that a default value can be provided.

!!! Live example
{HTML()}<pre>*''lalala'' is: &#123;&#123;lalala&#125;&#125;
*''lalala'' is:  &#123;&#123;lalala|nothing&#125;&#125; </pre>{HTML}

Shows:
^
*''lalala'' is: {{lalala}}
*''lalala'' is: {{lalala|nothing}}^
Follow the link to give a value to ''lalala'': [tiki-index.php?page=Wiki+Argument+Variables&lalala=trololo]

!!! Example in a profile
You can see it in action in this profile:
* ((pr:GeoCMS_Maps_22)) - See the "Sant Andreu" page created by the profile

!! URL parameter variable
You can use URL parameter to pass and create a variable to be displayed on a Wiki page or be used in a plugin.

!!! Example
Click on [Wiki-Argument-Variables?testVar=Nice|this link] (Wiki-Argument-Variables?testVar=Nice) to populate the variable "testVar" on this page that will be displayed below. (empty when you load the page without the URL parameter)
The variable testVar = {{testVar}}

Alias names for this page:
(alias(ArgumentVariables)) | (alias(argvars)) | (alias(Argument Variables)) | (alias(arg vars))  | (alias(ArgumentVariable)) | (alias(argvar)) | (alias(Argument Variable)) | (alias(arg var)) | (alias(Wiki Argument Variable)) | (alias(WikiArgumentVariable)) | (alias(WikiArgumentVariables))