Examples/Parameter: multisecseparators (example 3): Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
m (Some adjustments to the explanation)
imported>FrozenPlum
m (Add the more via parser function, though put a warning in its surrogate template (since this is for example only and non-ideal use).)
Line 6: Line 6:
==Example==
==Example==


This example contains all the same elements as the prior examples, only it uses a [[Template:DPL parameter.surrogateexample|surrogate/phantom template]] to format the second and third column of results. The first column is included in the <code>{{DPL|listseparators}}</code> statement, to prevent the page name from being repeated in every subsequent line. This is advanced use of a surrogate template in combination with the format statement. For more simple examples of surrogate template use, see the [[Controlling output volume#include contents related to templates|include]] parameter as related to included contents from templates, and for information about tables see also the <code>{{DPL|table}}</code> and <code>{{DPL|tablerow}}</code> parameters.
This example contains all the same elements as the prior examples, only it uses a [[Template:DPL parameter.surrogateexample|surrogate/phantom template]] to format the second and third column of results. The first column is included in the <code>{{DPL|listseparators}}</code> statement, to prevent the page name from being repeated in every subsequent line. The second column, formatted in the surrogate, has a link constructed to link to the page and parameter name (as the heading/chapter anchor to its matching page heading)<code><nowiki>[[{{{%PAGE%}}}#{{{name}}}|{{{name}}}]]</nowiki></code>. The third column, formatted in the surrogate, uses the #sub [[mw:Help:Extension:ParserFunctions##sub|Parser (string) Function]] <code><nowiki>{{#sub:{{{purpose|}}}|0|50}}</nowiki></code> to shorten the "purpose" parameter value to 50 characters. This is advanced use of a surrogate template in combination with the format statement. For more simple examples of surrogate template use, see the [[Controlling output volume#include contents related to templates|include]] parameter as related to included contents from templates, and for information about tables see also the <code>{{DPL|table}}</code> and <code>{{DPL|tablerow}}</code> parameters.
{{note|This example's surrogate template requires that <code>[[mw:Extension:ParserFunctions|$wgPFEnableStringFunctions]]</code> be set to "true" (enabled) in order to function correctly; on Miraheze, this is a setting that can be found and enabled in [[meta:ManageWiki|ManageWiki]].}}

<pre>
<pre>
{{#dpl:
{{#dpl:

Revision as of 21:43, 11 April 2022

Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

Example

This example contains all the same elements as the prior examples, only it uses a surrogate/phantom template to format the second and third column of results. The first column is included in the listseparators statement, to prevent the page name from being repeated in every subsequent line. The second column, formatted in the surrogate, has a link constructed to link to the page and parameter name (as the heading/chapter anchor to its matching page heading)[[{{{%PAGE%}}}#{{{name}}}|{{{name}}}]]. The third column, formatted in the surrogate, uses the #sub Parser (string) Function {{#sub:{{{purpose|}}}|0|50}} to shorten the "purpose" parameter value to 50 characters. This is advanced use of a surrogate template in combination with the format statement. For more simple examples of surrogate template use, see the include parameter as related to included contents from templates, and for information about tables see also the table and tablerow parameters.

This example's surrogate template requires that $wgPFEnableStringFunctions be set to "true" (enabled) in order to function correctly; on Miraheze, this is a setting that can be found and enabled in ManageWiki.
{{#dpl:
|category           = Primary Module
|nottitlematch	    = %volume%¦%page selection%
|uses		        = Template:DPL Parameter
|include	        = {dpl manual}:,{DPL parameter}.surrogateexample
|mode		        = userformat
|listseparators     = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a phantom template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦[[%PAGE%]]¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦}
|secseparators      = ,¶¦class="dpl-orange-background"¦,
|multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦
}}

Result

{{#dpl: |category = Primary Module |nottitlematch = %volume%¦%page selection% |uses = Template:DPL Parameter |include = {dpl manual}:,{DPL parameter}.surrogateexample |mode = userformat |listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a phantom template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦%PAGE%¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |secseparators = ,¶¦class="dpl-orange-background"¦, |multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ }}