Template:Sandwich Var/doc

This template is used in two parts in a similar fashion to {{#vardefine}} / {{#var}}

Defining a Sandwich Var
{	"params": { "1": {			"label": "Mode", "description": "This must be set to \"define\" (and is by default if the parameter is specified but not provided value).", "type": "string", "autovalue": "define", "default": "define", "required": true },		"2": {			"label": "Name", "description": "This must be set to the name that will prefix the stored \"start\" and \"end\" variable names (which is also used later to call the Sandwich Var). This name is case-sensitive.", "type": "string", "required": true },		"start": { "label": "start", "description": "The content to be stored in the start variable.", "type": "content", "required": true },		"end": { "label": "end", "description": "The content to be stored in the end variable.", "type": "content", "required": true }	},	"description": "On first use, this template defines 2 variables (_start & _end), each with their respective user-specified content.", "format": "inline", "paramOrder": [ "1",		"2",		"start", "end" ] }

Calling an existing Sandwich Var
{	"params": { "1": {			"label": "Name", "description": "This must be set to the name of an existing Sandwich Var. This name is case-sensitive.", "type": "string", "required": true },		"content": { "label": "content", "description": "The content to be sandwiched between the start and end variables.", "type": "content" }	},   "description": "An existing Sandwich Var can be called as many times as needed in an article by the name provided in  with a  parameter in order to print content to a page in the format of \"\".", "format": "inline", "paramOrder": [ "1",		"content" ] }

Subsequent Uses

 * Note that, at any time in an article after initially defining a Sandwich Var, that Sandwich Var can be redefined with new values simply by defining a new instance with the same name.


 * For more advanced cases, each of the variables that a Sandwich Var defines can also be directly accessed/redefined with {{#var}} {{#vardefine}} respectively. The names of the variables will always be "_start" and "_end" both prefixed with the name initially provided for the Sandwich Var.

Example: A Sandwich Var is defined with {{Sandwich Var||Peanut_Butter|start=Starting content.|end=Ending content.}} (notice the first parameter is left blank so it defaults to "define"), and the values of "start" and "end" can be directly accessed and redefined in the page they were initially defined in using {{#var: Peanut_Butter_start }} , {{#vardefine: Peanut_Butter_start | NEW VALUE }} , {{#var: Peanut_Butter_end }}, & {{#vardefine: Peanut_Butter_end | NEW VALUE }} respectively.