Difference between revisions of "Wikitext variables"
(Imported from Wikispaces) |
(Imported from Wikispaces) |
||
Line 1: | Line 1: | ||
− | |||
− | =wikitext variables= | + | ====== wikitext variables ====== |
− | + | ====== Table of Contents ====== | |
− | =Table of Contents= | + | [[#Introduction| Introduction]][[#Examples| Examples]][[#Examples-Template| Template]][[#Examples-Last Edit Footer| Last Edit Footer]][[#Variable Description| Variable Description]][[#Variable Description-Namespace| Namespace]][[#Variable Description-Page| Page]][[#Variable Description-Revision| Revision]][[#Variable Description-Revision Dates| Revision Dates]][[#Variable Description-Creation| Creation]][[#Variable Description-Creation Dates| Creation Dates]][[#Modifiers| Modifiers]][[#Modifiers-Output Modifiers| Output Modifiers]][[#Modifiers-Scope Modifiers| Scope Modifiers]][[#Javascript Variables| Javascript Variables]][[#Javascript Variables--User/Space Definition Variables| User/Space Definition Variables]][[#Javascript Variables--URL Construction Variables| URL Construction Variables]] |
− | + | ====== Introduction ====== | |
− | =Introduction= | + | Wikispaces Variables allow you to use dynamic content in your pages. That is, the content you create using variables is automatically updated to reflect some underlying information, like the number of pages in your space or the current date.\\ \\ Variables can be used anywhere in the Wikitext, and are replaced with their values when the page is displayed. Variables take the form {$VARIABLENAME} and can optionally be modified with a modifier in the form {$VARIABLENAME|MODIFIERNAME}.\\ \\ Variables are particularly useful when used with [[include page="..."]] and [[http://www.wikispaces.com/help#templates| templates] to create customized default pages, common headers and footers, or other dynamic pages.\\ \\ Note: Since pages are sometimes cached after being created, some items, such as the number of pages in the space, may not be updated immediately.\\ \\ |
− | Wikispaces Variables allow you to use dynamic content in your pages. That is, the content you create using variables is automatically updated to reflect some underlying information, like the number of pages in your space or the current date. | + | ====== Examples ====== |
− | =Examples= | + | ===== Template ===== |
− | ==Template== | + | This example is for a simple product review template header that inserts the product name based on the page name, the reviewer and date of the review. It can be saved as a template available for new pages.\\ |
− | This example is for a simple product review template header that inserts the product name based on the page name, the reviewer and date of the review. It can be saved as a template available for new pages. | + | =Product Review= |
− | + | Item Name: {$page} | |
− | + | Product Website: [[http://www.a.different.website.com/{$page| url}] | |
− | + | Reviewed By: {$revisioneditor} | |
− | + | Reviewed On: {$revisiondate} | |
− | + | ===== Last Edit Footer ===== | |
− | ==Last Edit Footer== | + | This is a snippet of wikitext that can be included in a footer at the bottom of the page to show information about the last revision of the page.\\ |
− | This is a snippet of wikitext that can be included in a footer at the bottom of the page to show information about the last revision of the page. | + | ---- |
− | + | This page has been edited {$pagerevisions} times. The last modification was made by | |
− | + | [[user:{$revisioneditor}]] on {$revisiondate} | |
− | + | ====== Variable Description ====== | |
− | =Variable Description= | + | |
− | + | | ===== Namespace ===== ||| | |
− | + | | Space name\\ | {$spacename}\\ | www\\ | | |
− | ==Namespace== | + | | Space text\\ | {$spacetext}\\ | College of William and Mary Wiki\\ | |
− | | | + | | Space description\\ | {$spacedescription}\\ | \\ | |
− | | Space name | + | | Page Count\\ | {$pagesinspace}\\ | 135\\ | |
− | | {$spacename} | + | | Servername (the hostname of the Wikispace)\\ | {$servername}\\ | www.wmwikis.net\\ | |
− | | www | + | | Server (the url for the main page of the Wikispace)\\ | {$server}\\ | https://www.wmwikis.net\\ | |
− | | | + | | License\\ | {$licensename}\\ | Creative Commons Attribution Share-Alike 3.0 License\\ | |
− | | Space text | + | | License URL\\ | {$licenseurl}\\ | http://www.creativecommons.org/licenses/by-sa/3.0\\ | |
− | | {$spacetext} | + | | Member Count\\ | {$membersinspace}\\ | 2\\ | |
− | | College of William and Mary Wiki | + | | Organizer Count\\ | {$organizersinspace}\\ | 1\\ | |
− | | | + | | ===== Page ===== ||| |
− | | Space description | + | | Page Name\\ | {$page}\\ | About WMWikis\\ | |
− | + | | Revision count\\ | {$pagerevisions}\\ | 2\\ | | |
− | | | + | | Full Page Name (alias for {$spacename}:{$page})\\ | {$fullpagename}\\ | www:About WMWikis\\ | |
− | | | + | | ===== Revision ===== ||| |
− | | Page Count | + | | Editor (Username of the user, or the IP address of the guest, who created this revision)\\ | {$revisioneditor}\\ | wmadmin\\ | |
− | | {$pagesinspace} | + | | Comment\\ | {$revisioncomment}\\ | \\ | |
− | | 135 | + | | Revision ID\\ | {$revisionid}\\ | 199832992\\ | |
− | | | + | | ===== Revision Dates ===== ||| |
− | | Servername (the hostname of the Wikispace) | + | | Date (In human readable format)\\ | {$revisiondate}\\ | Feb 8, 2011 11:46 am\\ | |
− | | {$servername} | + | | Day\\ | {$revisionday}\\ | 8\\ | |
− | | www.wmwikis.net | + | | Day (with leading zero)\\ | {$revisionday2}\\ | 08\\ | |
− | | | + | | Month\\ | {$revisionmonth}\\ | 2\\ | |
− | | Server (the url for the main page of the Wikispace) | + | | Year\\ | {$revisionyear}\\ | 2011\\ | |
− | | {$server} | + | | Timestamp (In [[http://en.wikipedia.org/wiki/en:ISO_8601| ISO 8601] Format)\\ | {$revisiontimestamp}\\ | 2011-02-08T19:46:42+00:00\\ | |
− | | https://www.wmwikis.net | + | | ===== Creation ===== ||| |
− | | | + | | Creator(Username of the user, or the IP address of the guest, who created this page)\\ | {$creator}\\ | wmadmin\\ | |
− | | License | + | | Comment\\ | {$creationcomment}\\ | \\ | |
− | | {$licensename} | + | | Creation Page ID\\ | {$creationid}\\ | 42706373\\ | |
− | | Creative Commons Attribution Share-Alike 3.0 License | + | | ===== Creation Dates ===== ||| |
− | + | | Date (In human readable format)\\ | {$creationdate}\\ | Oct 20, 2008 6:54 am\\ | | |
− | | License URL | + | | Day\\ | {$creationday}\\ | 20\\ | |
− | | {$licenseurl} | + | | Day (with leading zero)\\ | {$creationday2}\\ | 20\\ | |
− | | http://www.creativecommons.org/licenses/by-sa/3.0 | + | | Month\\ | {$creationmonth}\\ | 10\\ | |
− | | | + | | Year\\ | {$creationyear}\\ | 2008\\ | |
− | | Member Count | + | | Timestamp (In [[http://en.wikipedia.org/wiki/en:ISO_8601| ISO 8601] Format)\\ | {$creationtimestamp}\\ | 2008-10-20T13:54:36+00:00\\ | |
− | | {$membersinspace} | + | \\ |
− | | 2 | + | ====== Modifiers ====== |
− | + | Modifiers are used to change the value of the variable into a different format. Modifiers are separated from the variable name with the pipe (|) character, and can be combined together. For example, {$pagename|ignoreinclude|url}\\ \\ | |
− | | Organizer Count | + | |
− | | {$organizersinspace} | + | | ===== Output Modifiers ===== ||| |
− | | 1 | + | | Url escaping\\ | |url (e.g. {$server|url} )\\ | https%3A%2F%2Fwww.wmwikis.net\\ | |
− | | | + | | ===== Scope Modifiers ===== ||| |
− | | | + | | Ignore Include (Gets the value for the variable at the actual page that the variable lives on, possibly an included file)\\ | |ignoreinclude (e.g. {$pagename|ignoreinclude} )\\ | wikitext variables\\ | |
− | ==Page== | + | \\ |
− | | | + | ====== Javascript Variables ====== |
− | | Page Name | + | While editing Pages, it is possible to include Javascript inside an Embedded Object.\\ Several variables can be accessed from the client side to determine the current state of the application, as follows:\\ |
− | + | ||
− | | About WMWikis | + | | ==== User/Space Definition Variables ==== | \\ | \\ | |
− | | | + | | wikispaces_isUserLoggedIn\\ | boolean\\ | set if user has entered valid login information\\ | |
− | | Revision count | + | | wikispaces_username\\ | string\\ | set to current user's login handle\\ | |
− | | {$pagerevisions} | + | | wikispaces_spaceName\\ | string\\ | set to current Space that user is viewing\\ | |
− | | 2 | + | | ==== URL Construction Variables ==== | \\ | \\ | |
− | | | + | | wikispaces_method\\ | string\\ | system - type of function being performed ( 'view', etc. )\\ | |
− | | Full Page Name (alias for {$spacename}:{$page}) | + | | wikispaces_object\\ | string\\ | system - type of object being viewed/modified ( 'message', etc. )\\ | |
− | | {$fullpagename} | + | | wikispaces_page\\ | string\\ | set to name of current wikipage\\ | |
− | | www:About WMWikis | + | | wikispaces_id\\ | string\\ | system - object identifier ( for messages )\\ | |
− | | | + | \\ This page last edited by - [[https://www.wmwikis.net/user/view/wmadmin| <span style="font-family:monospace">https:''www.wmwikis.net/user/pic/wmadmin-lg.jpg?16x16|wmadmin</span>] [[https://www.wmwikis.net/user/view/wmadmin| wmadmin] on Feb 8, 2011 11:46 am (2 total edits) |
− | | | ||
− | ==Revision== | ||
− | | | ||
− | | Editor (Username of the user, or the IP address of the guest, who created this revision) | ||
− | | {$revisioneditor} | ||
− | | wmadmin | ||
− | | | ||
− | | Comment | ||
− | | {$revisioncomment} | ||
− | | | ||
− | | | ||
− | | Revision ID | ||
− | | {$revisionid} | ||
− | | 199832992 | ||
− | | | ||
− | | | ||
− | ==Revision Dates== | ||
− | | | ||
− | | Date (In human readable format) | ||
− | | {$revisiondate} | ||
− | | Feb 8, 2011 11:46 am | ||
− | | | ||
− | | Day | ||
− | | {$revisionday} | ||
− | | 8 | ||
− | | | ||
− | | Day (with leading zero) | ||
− | | {$revisionday2} | ||
− | | 08 | ||
− | | | ||
− | | Month | ||
− | | {$revisionmonth} | ||
− | | 2 | ||
− | |||
− | | Year | ||
− | | {$revisionyear} | ||
− | | 2011 | ||
− | | | ||
− | | | ||
− | Timestamp (In [http://en.wikipedia.org/wiki/en:ISO_8601 ISO 8601] Format) | ||
− | | {$revisiontimestamp} | ||
− | | 2011-02-08T19:46:42+00:00 | ||
− | | | ||
− | |||
− | ==Creation== | ||
− | | | ||
− | | Creator(Username of the user, or the IP address of the guest, who created this page) | ||
− | | {$creator} | ||
− | | wmadmin | ||
− | |||
− | | Comment | ||
− | | {$creationcomment} | ||
− | | | ||
− | | | ||
− | | Creation Page ID | ||
− | | {$creationid} | ||
− | | 42706373 | ||
− | | | ||
− | |||
− | ==Creation Dates== | ||
− | | | ||
− | | Date (In human readable format) | ||
− | | {$creationdate} | ||
− | | Oct 20, 2008 6:54 am | ||
− | | | ||
− | | Day | ||
− | |||
− | | 20 | ||
− | | | ||
− | | Day (with leading zero) | ||
− | | {$creationday2} | ||
− | | 20 | ||
− | | | ||
− | | Month | ||
− | | {$creationmonth} | ||
− | | 10 | ||
− | | | ||
− | | Year | ||
− | | {$creationyear} | ||
− | | 2008 | ||
− | | | ||
− | | | ||
− | Timestamp (In [http://en.wikipedia.org/wiki/en:ISO_8601 ISO 8601] Format) | ||
− | | {$creationtimestamp} | ||
− | |||
− | | | ||
− | |||
− | =Modifiers= | ||
− | Modifiers are used to change the value of the variable into a different format. Modifiers are separated from the variable name with the pipe (|) character, and can be combined together. For example, {$pagename|ignoreinclude|url} | ||
− | |||
− | |||
− | ==Output Modifiers== | ||
− | | | ||
− | | Url escaping | ||
− | | |url (e.g. {$server|url} ) | ||
− | | https%3A%2F%2Fwww.wmwikis.net | ||
− | | | ||
− | | | ||
− | ==Scope Modifiers== | ||
− | | | ||
− | | Ignore Include (Gets the value for the variable at the actual page that the variable lives on, possibly an included file) | ||
− | | |ignoreinclude (e.g. {$pagename|ignoreinclude} ) | ||
− | | wikitext variables | ||
− | | | ||
− | |||
− | = | ||
− | While editing Pages, it is possible to include Javascript inside an Embedded Object. | ||
− | |||
− | |||
− | ===User/Space Definition Variables=== | ||
− | | | ||
− | |||
− | |||
− | | wikispaces_isUserLoggedIn | ||
− | | boolean | ||
− | | set if user has entered valid login information | ||
− | | | ||
− | | wikispaces_username | ||
− | | string | ||
− | | set to current user's login handle | ||
− | |||
− | | wikispaces_spaceName | ||
− | | string | ||
− | | set to current Space that user is viewing | ||
− | | | ||
− | | | ||
− | ===URL Construction Variables=== | ||
− | | | ||
− | | | ||
− | | | ||
− | | wikispaces_method | ||
− | | string | ||
− | | system - type of function being performed ( 'view', etc. ) | ||
− | | | ||
− | | wikispaces_object | ||
− | | string | ||
− | | system - type of object being viewed/modified ( 'message', etc. ) | ||
− | | | ||
− | | wikispaces_page | ||
− | | string | ||
− | |||
− | | | ||
− | | wikispaces_id | ||
− | | string | ||
− | | system - object identifier ( for messages ) | ||
− | | | ||
− |
Latest revision as of 14:29, 14 February 2019
wikitext variables
Table of Contents
Introduction Examples Template Last Edit Footer Variable Description Namespace Page Revision Revision Dates Creation Creation Dates Modifiers Output Modifiers Scope Modifiers Javascript Variables User/Space Definition Variables URL Construction Variables
Introduction
Wikispaces Variables allow you to use dynamic content in your pages. That is, the content you create using variables is automatically updated to reflect some underlying information, like the number of pages in your space or the current date.\\ \\ Variables can be used anywhere in the Wikitext, and are replaced with their values when the page is displayed. Variables take the form {$VARIABLENAME} and can optionally be modified with a modifier in the form {$VARIABLENAME|MODIFIERNAME}.\\ \\ Variables are particularly useful when used with include page="..." and [templates to create customized default pages, common headers and footers, or other dynamic pages.\\ \\ Note: Since pages are sometimes cached after being created, some items, such as the number of pages in the space, may not be updated immediately.\\ \\
Examples
Template
This example is for a simple product review template header that inserts the product name based on the page name, the reviewer and date of the review. It can be saved as a template available for new pages.\\ =Product Review= Item Name: {$page} Product Website: [url} Reviewed By: {$revisioneditor} Reviewed On: {$revisiondate}
This is a snippet of wikitext that can be included in a footer at the bottom of the page to show information about the last revision of the page.\\ ---- This page has been edited {$pagerevisions} times. The last modification was made by [[user:{$revisioneditor}]] on {$revisiondate}
Variable Description
| ===== Namespace ===== ||| | Space name\\ | {$spacename}\\ | www\\ | | Space text\\ | {$spacetext}\\ | College of William and Mary Wiki\\ | | Space description\\ | {$spacedescription}\\ | \\ | | Page Count\\ | {$pagesinspace}\\ | 135\\ | | Servername (the hostname of the Wikispace)\\ | {$servername}\\ | www.wmwikis.net\\ | | Server (the url for the main page of the Wikispace)\\ | {$server}\\ | https://www.wmwikis.net\\ | | License\\ | {$licensename}\\ | Creative Commons Attribution Share-Alike 3.0 License\\ | | License URL\\ | {$licenseurl}\\ | http://www.creativecommons.org/licenses/by-sa/3.0\\ | | Member Count\\ | {$membersinspace}\\ | 2\\ | | Organizer Count\\ | {$organizersinspace}\\ | 1\\ | | ===== Page ===== ||| | Page Name\\ | {$page}\\ | About WMWikis\\ | | Revision count\\ | {$pagerevisions}\\ | 2\\ | | Full Page Name (alias for {$spacename}:{$page})\\ | {$fullpagename}\\ | www:About WMWikis\\ | | ===== Revision ===== ||| | Editor (Username of the user, or the IP address of the guest, who created this revision)\\ | {$revisioneditor}\\ | wmadmin\\ | | Comment\\ | {$revisioncomment}\\ | \\ | | Revision ID\\ | {$revisionid}\\ | 199832992\\ | | ===== Revision Dates ===== ||| | Date (In human readable format)\\ | {$revisiondate}\\ | Feb 8, 2011 11:46 am\\ | | Day\\ | {$revisionday}\\ | 8\\ | | Day (with leading zero)\\ | {$revisionday2}\\ | 08\\ | | Month\\ | {$revisionmonth}\\ | 2\\ | | Year\\ | {$revisionyear}\\ | 2011\\ | | Timestamp (In [ISO 8601 Format)\\ | {$revisiontimestamp}\\ | 2011-02-08T19:46:42+00:00\\ | | ===== Creation ===== ||| | Creator(Username of the user, or the IP address of the guest, who created this page)\\ | {$creator}\\ | wmadmin\\ | | Comment\\ | {$creationcomment}\\ | \\ | | Creation Page ID\\ | {$creationid}\\ | 42706373\\ | | ===== Creation Dates ===== ||| | Date (In human readable format)\\ | {$creationdate}\\ | Oct 20, 2008 6:54 am\\ | | Day\\ | {$creationday}\\ | 20\\ | | Day (with leading zero)\\ | {$creationday2}\\ | 20\\ | | Month\\ | {$creationmonth}\\ | 10\\ | | Year\\ | {$creationyear}\\ | 2008\\ | | Timestamp (In [ISO 8601 Format)\\ | {$creationtimestamp}\\ | 2008-10-20T13:54:36+00:00\\ | \\
Modifiers
Modifiers are used to change the value of the variable into a different format. Modifiers are separated from the variable name with the pipe (|) character, and can be combined together. For example, {$pagename|ignoreinclude|url}\\ \\
| ===== Output Modifiers ===== ||| | Url escaping\\ | |url (e.g. {$server|url} )\\ | https%3A%2F%2Fwww.wmwikis.net\\ | | ===== Scope Modifiers ===== ||| | Ignore Include (Gets the value for the variable at the actual page that the variable lives on, possibly an included file)\\ | |ignoreinclude (e.g. {$pagename|ignoreinclude} )\\ | wikitext variables\\ | \\
Javascript Variables
While editing Pages, it is possible to include Javascript inside an Embedded Object.\\ Several variables can be accessed from the client side to determine the current state of the application, as follows:\\
| ==== User/Space Definition Variables ==== | \\ | \\ | | wikispaces_isUserLoggedIn\\ | boolean\\ | set if user has entered valid login information\\ | | wikispaces_username\\ | string\\ | set to current user's login handle\\ | | wikispaces_spaceName\\ | string\\ | set to current Space that user is viewing\\ | | ==== URL Construction Variables ==== | \\ | \\ | | wikispaces_method\\ | string\\ | system - type of function being performed ( 'view', etc. )\\ | | wikispaces_object\\ | string\\ | system - type of object being viewed/modified ( 'message', etc. )\\ | | wikispaces_page\\ | string\\ | set to name of current wikipage\\ | | wikispaces_id\\ | string\\ | system - object identifier ( for messages )\\ | \\ This page last edited by - [https:www.wmwikis.net/user/pic/wmadmin-lg.jpg?16x16|wmadmin [wmadmin on Feb 8, 2011 11:46 am (2 total edits)