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

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
m (fix spacing)
imported>FrozenPlum
m (FrozenPlum moved page Controlling output format/Parameter: format (example 3) to Examples/Parameter: format (example 3): Simplifying how things are structured)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
==Example==
==Example==


This will list articles in [[:Category:Number examples]] that linkto the article named [[Two]]. The results will be limited to a count of five, and the format made into a table by doing the following in the format statement (whose syntax is: <code>format = ''Startall'',''Start'',''End'',''Endall''</code>):
This will list articles in [[:Category:Number examples]] that linkto the article named [[Two]]. The results will be limited to a count of five, and the <code>format</code> syntax used to create a table.<br>



* <code><nowiki>{|</nowiki></code> in <code>''Startall''</code> position of the syntax, to specify the wikitext to begin a table.
As a reminder, the syntax is <code>format = ''Startall'',''Start'',''End'',''Endall''</code>):
* <code><nowiki>¶¦-¶¦</nowiki></code> followed by <code><nowiki>[[%PAGE%]]</nowiki></code> in the <code>''Start''</code> position of the syntax, to specify the wikitext to begin a table row and cell, followed by a link to the page.

* The <code>''End''</code> position of the syntax is intentionally omitted because there is no wikitext required to end a table row.
* <code><nowiki>¶|}</nowiki></code> in the "Endall" position of the syntax, to specify the table-end wikitext.
* <code>''Startall''</code> specifies the wikitext to begin a table <code><nowiki>{|</nowiki></code>.
* <code>''Start''</code> — specifies the wikitext to begin table row and cell (followed by the content, a link to the page) <code><nowiki>¶¦-¶¦[[%PAGE%]]</nowiki></code>.
* <code>''End''</code> is intentionally empty <code>,</code> because no wikitext is needed to end a table row.
* <code>''Endall''</code> — specifies the table-end wikitext <code><nowiki>¶|}</nowiki></code>.


<pre>
<pre>
Line 20: Line 23:
|format = {¦ class="wikitable" ¶!pages found,¶¦-¶¦[[%PAGE%]],,¶¦}
|format = {¦ class="wikitable" ¶!pages found,¶¦-¶¦[[%PAGE%]],,¶¦}
}}
}}
</pre>

'''Notes:'''
* <code>''Start''</code> position of the <code>format=</code> syntax starts and formats a row of output, which is then applied to ''each'' item in the result set.
* In the case of results outside of the ''Main'' namespace, such as in the "Category" namespace, if "Category:" is not desired in the page title/link, <code><nowiki>[[%PAGE%|%TITLE%]]</nowiki></code> can be used instead.
* The {{DPL|table}} parameter, in combination with {{DPL|tablerow}} and the {{DPL|include}}/{{DPL|includepage}} parameter, can also be used to output table syntax.

OR

<pre>
<dpl>
category = Number examples
linksto = Two
count = 5
format = {| class="wikitable" ¶!pages found,¶|-¶|[[%PAGE%]],,¶|}
</dpl>
</pre>
</pre>



Latest revision as of 23:52, 31 March 2023

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 will list articles in Category:Number examples that linkto the article named Two. The results will be limited to a count of five, and the format syntax used to create a table.


As a reminder, the syntax is format = Startall,Start,End,Endall):

  • Startall — specifies the wikitext to begin a table {|.
  • Start — specifies the wikitext to begin table row and cell (followed by the content, a link to the page) ¶¦-¶¦[[%PAGE%]].
  • End — is intentionally empty , because no wikitext is needed to end a table row.
  • Endall — specifies the table-end wikitext ¶|}.
{{#dpl:
|category = Number examples
|linksto  = Two
|count    = 5
|format   = {¦ class="wikitable" ¶!pages found,¶¦-¶¦[[%PAGE%]],,¶¦}
}}

Result

{{#dpl: |category = Number examples |linksto = Two |count = 5 |format = {¦ class="wikitable" ¶!pages found,¶¦-¶¦%PAGE%,,¶¦} }}