Template:Dialog/init/doc
This is a documentation subpage for Template:Dialog/init It may contain usage information, categories and other content that is not part of the original template page. |
This is a dialog formatting template. It is meant for use on interactive dialog pages, and may involve interactions between wiki markup, HTML, and JavaScript. Please carefully test any edits before making them. |
Usage
[edit source]Use this template on a page to be accessed via dialog action do to specify an initial value for a dialog field, thus:
- {{dialog/init}}
This causes value to be processed through template-expansion, and the resulting value to be associated with dialog field name, as if it had been provided as an incoming dialog parameter, and overriding any dialog parameter name provided. This bypasses the ordinary processing by which the wiki software converts the output of template-expansion into html for viewing; the ordinary processing rearranges whitespace, linebreaks, and markup for list items, indentation, italics, wikilinks, and so on. Some, but not all, of the ordinary processing can be avoided by means of {{dialog/safe}}.
Ordinarily, the template call itself expands to the empty string. However, a non-blank third parameter causes the template call to expand to value.
The template call must appear on the accessed page itself, as it is processed by the do action before template-expansion of the page as a whole. This enhances security since arbitrary templates used on the dialog page cannot indirectly override dialog parameter values.
The value may contain template parameters processed by the do action (such as SUBJECT-CONTENT
, or incoming dialog parameters), as the action replaces those before processing calls to {{dialog/init}}. Because those template parameters are processed before {{dialog/init}} calls, they depend on incoming dialog parameters only, regardless of value or of any other call to {{dialog/init}}. The specified value will, however, override any incoming dialog parameter to determine the initial content of a dialog field called name.
Reserved parameter names — anything that starts with an upper-case letter and does not contain any lower-case letters — cannot be overridden using {{dialog/init}}; any attempt to do so is ignored.
Use this template sparingly, as each call processed may entail a separate call across the internet to the wiki server (though the dialog software will save itself the trouble if it notices value doesn't contain any template calls). As of this writing, only up to eight calls to this template are processed by action do; any additional calls do not affect dialog fields.
If a parameter provided through {{dialog/init}} is meant to be explicitly passed by a button (rather than implicitly passed by delegation), there has to be a dialog field on the page with the name of that parameter (typically declared using {{dialog/textarea}}); explicit button parameters are always taken from dialog fields, not from incoming dialog parameters.
Technical restrictions
[edit source]The value must not contain any unmatched braces ({
or }
) and must not have braces nested more than 32 deep (as of this writing). The unbalanced-braces problem can be avoided by using {{(*}} and {{*)}}. If these limtations are exceeded, the template call does not affect dialog fields (because the dialog software fails to recognize it in the raw wiki markup).
See also
[edit source]