ScopeTestPage

## Initial:

scopetestparam =`{{{scopetestparam}}}`

scopetestvar =

scopetestvar =

scopetestparam =`{{{scopetestparam}}}`

scopetestvar =`ScopeTest`

(With passed param:)

scopetestparam =`ScopeTestPage`

scopetestvar =`ScopeTestPage`

scopetestvar =`ScopeTestPage`

</noinclude>

scopetestvar =`ScopeTestPage`

scopetestparam =`{{{scopetestparam}}}`

scopetestvar =`ScopeTest`

(With passed param:)

scopetestparam =`ScopeTestPage`

scopetestvar =`ScopeTestPage`

scopetestvar =`ScopeTestPage`

</noinclude>

## Final:

scopetestparam =`{{{scopetestparam}}}`

scopetestvar =`ScopeTestPage`

## Observations:

* Parameters only obtain values when passed (or a default is set), and are local in scope to the template the values are passed to.
* Variables obtain values when defined (with a default value or otherwise), and are available to anything that transcludes them.
* Magic Words (e.g. BASEPAGENAME) are effectively based on the page, not any subsequent template.

## Conclusions:

* Variables can be defined anywhere, and are effectively global in scope - at least for the initial page and any subsequent templates.
	+ To avoid passing the same parameter multiple times, a variable could be set instead and simply utilized where needed.
* Values used to define parameters must be passed; if transcluding one template within another, they must be passed again.
	+ Variables make more sense for constant/static values.
	+ Parameters make more sense for values that vary with each use of a template (especially if the template is used more than once by the same page).
* Whether or not a particular template has been used could be defined by a corresponding named variable (e.g. {{#vardefine:TemplateName|1}}), although it must be noted that previewing a page/template provides that. However, it could still be useful internally if templates were being used conditionally.
* Having a generalized/generic variables template that can be used anywhere in the wiki would be useful.
	+ Parameters defined by a page (e.g. "franchise") would need to be passed to any template that needed them.
	+ If the value was needed in another template referenced by that template, it would need to be passed again.
	+ Variables set anywhere in that "chain" become available to the entire chain - even the original page.
	+ While that creates a dependency, it also helps to ensure consistent values, behaviors, and standards.
	+ In a DIW context, creating such variable templates on a per franchise basis might seem... "excessive", unless the total number of pages related to each franchise vs the number of variables to be (re)defined per page (vs the complexity of setting them) were taken into consideration. Examples:
		- For "Frozen", the short name \*is\* the franchise name; don't need to override it manually.
		- For "Pirates of the Caribbean", the short name can be parsed as just the first word ("Pirates").
		- For "Finding Nemo", the short name is the second word; this can't be determined automatically, and must be set explicitly (unless a template established a number of "naming conventions", and which parsing model was passed, which in turn might get unnecessarily complex - don't write code just for the sake of writing code, eh?).