Template:DPL parameter.surrogateexample: Difference between revisions

no edit summary
imported>FrozenPlum
(Create a simpler example for surrogate use)
 
imported>FrozenPlum
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1:
[[{{{%PAGE%}}}#{{{name}}}|%TITLE%{{{name}}}]]||{{#sub:{{{purpose|}}}|0|50}} {{#ifeq: {{#expr: {{#len:{{{purpose|}}}}} > 50}} | 1 | [[{{{%PAGE%}}}#{{{name}}}|{{{name}}}more ...]] | {{{purpose|}}}<noinclude>
 
<!-- Documentation here -->
'''View this page's source to see each of the columns it creates in the table it is used in''' (it formats the second and the third column of results) used in only [[Controlling output format/Parameter: multisecseparators (example 3)|Parameter: multisecseparators (example 3)]].
This template is a surrogate template (also called a 'phantom template') example that formats one result/line of DPL output. DPL then reuses and applies the surrogate template's formatting to each result/line in the output.
 
Surrogate/phantom templates are used by setting the template name in <code>includepage = {templatename}.suffix</code> (changing the suffix to whatever is descriptive of template purpose).
 
This template is a surrogate template (also called a 'phantom template') example that formats one result/line of DPL output. DPL then reuses and applies thethis surrogate template's formatting to each result/line in the output list.
Naming the surrogate/phantom template after its parent, and then adding [[Controlling output volume#Include contents related to templates|a descriptive suffix on the end]], ensures both the parent and surrogate are easily found, and their relationship to each other easily understood. This style of naming them is particularly useful when looking in the Templates category.
 
Surrogate/phantom templates are used by setting the template name in <code>includepage = {templatename}.suffix</code> (changing the suffix to whatever the template name is, usually the suffix is descriptive of template purpose).
 
Naming the surrogate/phantom template after its parent, and then adding [[Controlling output volume#Include contents related to templates|a descriptive suffix on the end]], ensures both the parent and surrogate are easily found, and their relationship to each other easily understood. This style of naming them is particularly useful when looking at templates in [[Special:AllPages]] (and selecting the Templatestemplates drop-down categoryoption).
{{note|This surrogate template requires the [[mw:Extension:ParserFunctions|ParserFunctions]] extension, and it requires <code>[[mw:Extension:ParserFunctions|$wgPFEnableStringFunctions]]</code> to be set to "true" (enabled) in order to function correctly; on Miraheze, ParserFunctions is already installed and the latter setting can be found and enabled in [[meta:ManageWiki|ManageWiki]]. The #sub parser function, used to add the "more..." text in this example, is for demonstration purposes only; it may break ''nowiki'' or other tags (creating undesired results) if it splits a result in the middle of one of such tags.}}
 
[[Category:Surrogate (phantom) templates]]
[[Category:Uses ParserFunctions string functions]]
<noinclude>
Anonymous user