Examples/Parameter: listattr (example 1): Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
m (update to match, the labelling was not super helpful)
imported>FrozenPlum
(Classes to match simplified example)
 
(4 intermediate revisions by the same user not shown)
Line 6: Line 6:
==Example==
==Example==


This will select articles in [[:Category:Countries in Africa]] or [[:Category:Countries in Europe]] the categories are listed in sorted order and the titles are replaced by appropriate links <code>headingmode</code> is set to ''definition'' so the headings appear as terms/names. By default, <code>{{DPL|mode}}</code> is ''unordered'' for the articles under the headings, so they are bulleted. <code>listattr</code> is set to have a blue CSS class which colors all items in the unordered list, and <code>itemattr</code> is set to apply a class and a font style (italic), which applies to each individual list item.
This selects articles in [[:Category:Countries in Africa]] or [[:Category:Countries in Europe]] and orders them by ''category'' (which is used in combination with <code>headingmode</code> to put the category as the header). <code>{{DPL|mode}}</code> is set to ''ordered'' which causes the articles listed under the categories to be numbered. The <code>hlistattr</code> adds formatting at the heading/top level, enclosing all other items; for that, an ID, orange color, and other styles are given. <code>hitemattr</code> adds an ID, color pink/red color, and other styles to the next corresponding list item heading. <code>listattr</code> applies to list '''type declaration''' elements, in this case the ordered (ol) list elements, coloring them blue.


<pre>
<pre>
{{#dpl:
{{#dpl:
|category = Countries in Africa¦Countries in Europe
|category = Countries in Africa¦Countries in Europe
|ordermethod = category,title
|ordermethod = category,pagetouched
|headingmode = definition
|headingmode = definition
|mode = ordered
|listattr = id="ul-example" class="dpl-blue-background"
|itemattr = class="li-example" style= "font-style: italic;"
|hlistattr = id="dl-example" class="dpl-orange-background"
|hitemattr = id="list-item-heading-attrubite" class="list-item-heading-attrubite"
|count = 2
|listattr = id="ol-example" class="dpl-blue-background"
|count = 3
}}
}}
</pre>
</pre>
Line 23: Line 25:
{{#dpl:
{{#dpl:
|category = Countries in Africa¦Countries in Europe
|category = Countries in Africa¦Countries in Europe
|ordermethod = category,title
|ordermethod = category,pagetouched
|headingmode = definition
|headingmode = definition
|mode = ordered
|listattr = id="ul-example" class="dpl-blue-background"
|itemattr = class="li-example" style= "font-style: italic;"
|hlistattr = id="dl-example" class="dpl-orange-background"
|hitemattr = id="list-item-heading-attrubite" class="list-item-heading-attrubite"
|count = 2
|listattr = id="ol-example" class="dpl-blue-background"
|count = 3
}}
}}
<noinclude>
<noinclude>
[[Category:Controlling output format (examples)‎]]
[[Category:Heading mode]]
[[Category:Uses category parameter]]
[[Category:Uses category parameter]]
[[Category:Uses ordermethod parameter]]
[[Category:Uses ordermethod parameter]]
[[Category:Uses headingmode parameter]]
[[Category:Uses headingmode parameter]]
[[Category:Uses mode parameter]]
[[Category:Uses hlistattr parameter]]
[[Category:Uses hitemattr parameter]]
[[Category:Uses listattr parameter]]
[[Category:Uses listattr parameter]]
[[Category:Uses itemattr parameter]]
[[Category:Uses count parameter]]
[[Category:Uses count parameter]]
</noinclude>
</noinclude>

Latest revision as of 19:44, 15 June 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 selects articles in Category:Countries in Africa or Category:Countries in Europe and orders them by category (which is used in combination with headingmode to put the category as the header). mode is set to ordered which causes the articles listed under the categories to be numbered. The hlistattr adds formatting at the heading/top level, enclosing all other items; for that, an ID, orange color, and other styles are given. hitemattr adds an ID, color pink/red color, and other styles to the next corresponding list item heading. listattr applies to list type declaration elements, in this case the ordered (ol) list elements, coloring them blue.

{{#dpl:
|category    = Countries in Africa¦Countries in Europe
|ordermethod = category,pagetouched
|headingmode = definition
|mode        = ordered
|hlistattr   = id="dl-example" class="dpl-orange-background"
|hitemattr   = id="list-item-heading-attrubite" class="list-item-heading-attrubite"
|listattr    = id="ol-example" class="dpl-blue-background"
|count       = 3
}}

Result

{{#dpl: |category = Countries in Africa¦Countries in Europe |ordermethod = category,pagetouched |headingmode = definition |mode = ordered |hlistattr = id="dl-example" class="dpl-orange-background" |hitemattr = id="list-item-heading-attrubite" class="list-item-heading-attrubite" |listattr = id="ol-example" class="dpl-blue-background" |count = 3 }}