Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Search
Editing
DPL3/Parameters: Controlling output format
(section)
From KB42
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
Edit source
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Heading mode == ===headingmode=== {{DPL parameter |name = headingmode |purpose= To control the output of the headings in a DPL with complex/multi-parameter {{dpl3|ordermethod}}. (No effect with single-param ordermethods.) For {{dpl3|ordermethod|=''method1,method2,...''}}, ''method1'' is used for headings. E.g. {{dpl3|headingmode}} affects category headings in {{dpl3|ordermethod|=category,title}} (2-param ordermethod). See also {{dpl3|headingcount}} }} Syntax: {{DPL syntax|headingmode=''modename''}} ''modename'' can be one of: * ''none'' — headings are not displayed, no heading — '''(default)''' * ''unordered'' — outputs an unordered list — HTML tag {{tt|ul}} * ''ordered'' — outputs an ordered list — HTML tag {{tt|ol}} * ''definition'' — outputs a definition list — HTML tag {{tt|dl}} * ''H2'' — outputs sections — HTML tags {{tt|H2}} {{red|Currently broken}} * ''H3'' — outputs sections — HTML tags {{tt|H3}} {{red|Currently broken}} * ''H4'' — outputs sections — HTML tags {{tt|H4}} {{red|Currently broken}} Example: <!-- originally, category=Africa|Europe --> <pre><nowiki> <dpl> category=Terraria Wiki|Community notcategory=Games nottitlematch=%d%|Disambiguations count=7 ordermethod=category,title headingmode=definition mode=ordered </dpl> </nowiki></pre> This list will output pages that belong to one of the categories Terraria Wiki, Community in a list similar to this (HTML source). The categories are listed in sorted order, and the titles are replaced with the appropriate links ({{dpl3|nottitlematch}} and {{dpl3|count}} are simply used to reduce the output size): {| ! '''(HTML) Output''' !! '''Actual Output''' |- style="vertical-align:top;" |<pre><nowiki> <dl> <dt>Category</dt> <dd> <ol> <li>Page1</li> <li>Page2</li> </ol> </dd> </dl> </nowiki></pre> | <dpl> category=Terraria Wiki|Community notcategory=Games nottitlematch=%d%|Disambiguations count=7 ordermethod=category,title headingmode=definition mode=ordered </dpl> |} Headingmode can be used with multi-column output but the length of the columns may in this case vary more than you would expect. ===headingcount=== {{DPL parameter |name = headingcount |purpose= In combination with {{dpl3|headingmode}} this parameter decides whether we show a text line with the number of articles per group or not. }} Syntax: {{DPL syntax|headingcount=''true''}} default is <code>headingcount=false</code> === listattr === {{DPL parameter |name = listattr |purpose= Adds attributes to HTML list elements, depending on {{dpl3|mode}} (HTML element is {{tt|ol}} for ordered, {{tt|ul}} for unordered, {{tt|div}} for others). Can be used with '''pseudo''' {{dpl3|mode|=inline}} where inline text contains one or more {{tt|<nowiki><br/></nowiki>}}. Only applicable to {{dpl3|mode|=ordered}} or {{dpl3|mode|=unordered}}. Not applicable to {{dpl3|mode|=category}} or {{dpl3|mode|=inline}} (with no {{tt|<nowiki><br/></nowiki>}} in inline text). }} Syntax: {{DPL syntax|listattr= attribute1="val1" attribute2="val2" ...}} Examples: {| ! '''Input''' !! '''(HTML) Output''' !! '''Actual Output''' |- style="vertical-align:top;" |width=30%|<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=none listattr= class="submenul" class="dpl light-background" itemattr= class="submenuli" style= "font-style: italic;" </dpl> </nowiki></pre> |<pre><nowiki> <ol> <li class="submenul" class="dpl light-background"> Cat1 (link) <div class="submenul"> <span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/> <span class="submenuli" style="font-style: italic;"> Page1_2 </span> </div> </li> <li class="submenul" class="dpl light-background"> Cat2 (link) <div class="submenul"> <span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/> <span class="submenuli" style="font-style: italic;"> Page2_2 </span> </div> </li> </ol> </nowiki></pre> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=none listattr= class="submenul" class="dpl light-background" itemattr= class="submenuli" style="font-style: italic;" </dpl> |- style="vertical-align:top;" |<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered listattr= class="submenul" class="dpl light-background" itemattr= class="submenuli" style= "font-style: italic;" </dpl> </nowiki></pre> |<pre><nowiki> <ol> <li> Cat1 (link) <ul class="submenul" class="dpl light-background"> <li class="submenuli" style="font-style: italic;"> Page1_1 </li> <li class="submenuli" style="font-style: italic;"> Page1_2 </li> </ul> </li> <li> Cat2 (link) <ul class="submenul" class="dpl light-background"> <li class="submenuli" style="font-style: italic;"> Page2_1 </li> <li class="submenuli" style="font-style: italic;"> Page2_2 </li> </ul> </li> </ol> </nowiki></pre> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered listattr= class="submenul" class="dpl light-background" itemattr= class="submenuli" style="font-style: italic;" </dpl> |} === itemattr === {{DPL parameter |name = itemattr |purpose= Adds attributes to HTML list items, depending on {{dpl3|mode}} (element is {{tt|li}} for ordered/unordered, {{tt|span}} for others). Not applicable to {{dpl3|mode|=category}}. }} Syntax: {{DPL syntax|itemattr= attribute1="val1" attribute2="val2" ...}} === hlistattr === {{DPL parameter |name = hlistattr |purpose= Adds attributes to the HTML list element at the heading/top level, depending on {{dpl3|headingmode}} (HTML element would be {{tt|ol}} for ordered, {{tt|ul}} for unordered, {{tt|dl}} for definition, {{tt|div}} for others) Not yet applicable to {{dpl3|headingmode|=none}}. }} Syntax: {{DPL syntax|hlistattr= attribute1="val1" attribute2="val2" ...}} Example: {| ! '''Input''' !! '''(HTML) Output''' !! '''Actual Output''' |- style="vertical-align:top;" |<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,pagetouched headingmode=definition mode=ordered hlistattr= class="topmenul" id="dmenu" style= "font-size:17px;" </dpl> </nowiki></pre> |<pre><nowiki> <div class="topmenul" id="dmenu" style="font-size:17px;"> <li> Category 2 (link) </li> <ol> <li>Page1_1</li> <li>Page1_2</li> </ol> <li> Category 2 (link) </li> <ol> <li>Page2_1</li> </ol> </div> </nowiki></pre> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,pagetouched headingmode=definition mode=ordered hlistattr= class="topmenul" id="dmenu" style="font-size:17px;" </dpl> |} These examples compare {{dpl3|listattr}}, {{dpl3|itemattr}}, and {{dpl3|hlistattr}} {| ! '''Input''' !! '''Actual Output''' |- style="vertical-align:top;" |<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered listattr= class="submenul" class="dpl light-background" itemattr= class="submenuli" style= "font-style: italic;" </dpl> </nowiki></pre> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered listattr= class="submenul" class="dpl light-background" itemattr= class="submenuli" style="font-style: italic;" </dpl> |- style="vertical-align:top;" |<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered listattr= class="submenul" itemattr= class="submenuli" class="dpl light-background" style= "font-style: italic;" </dpl> </nowiki></pre> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered listattr= class="submenul" itemattr= class="submenuli" class="dpl light-background" style="font-style: italic;" </dpl> |- style="vertical-align:top;" |<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered hlistattr= class="topmenul" id="dmenu" class="dpl light-background" listattr= class="submenul" itemattr= class="submenuli" style="font-style: italic;" </dpl> </nowiki></pre> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=definition mode=unordered hlistattr= class="topmenul" id="dmenu" class="dpl light-background" listattr= class="submenul" itemattr= class="submenuli" style="font-style: italic;" </dpl> |} See also {{dpl3|hitemattr}}. === hitemattr === {{DPL parameter |name = hitemattr |purpose= Adds attributes to HTML list items (headings) at the heading level, depending on {{dpl3|headingmode}} (HTML element would be {{tt|li}} for ordered/unordered, {{tt|div}} for others). To be used with {{dpl3|headingmode|=}}'unordered' or 'ordered'. (Not yet applicable for others.) }} Syntax: {{DPL syntax|hitemattr= attribute1="val1" attribute2="val2" ...}} Example: {| ! '''Input''' !! '''(HTML) Output''' !! '''Intended Output''' !! '''Actual Output''' |- style="vertical-align:top;" |<pre><nowiki> <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=unordered mode=ordered hlistattr= class="topmenul" id="dmenu" hitemattr= class="topmenuli" class="dpl light-background" </dpl> </nowiki></pre> |<pre><nowiki> <ul class="topmenul" id="dmenu"> <li class="topmenuli" class="dpl light-background"> Category 1 (link) <ol> <li>Page1_1</li> <li>Page1_2</li> </ol> </li> <li class="topmenuli" class="dpl light-background"> Category 2 (link) <ol> <li>Page2_1</li> </ol> </li> </ul> </nowiki></pre> | <ul class="topmenul" id="dmenu"> <li class="topmenuli" class="dpl light-background"> Category 1 (link) <ol> <li>Page1_1</li> <li>Page1_2</li> </ol> </li> <li class="topmenuli" class="dpl light-background"> Category 2 (link) <ol> <li>Page2_1</li> </ol> </li> </ul> | <dpl> category=Community nottitlematch=%Forums%|Admin% ordermethod=category,title headingmode=unordered mode=ordered hlistattr= class="topmenul" id="dmenu" hitemattr= class="topmenuli" class="dpl light-background" </dpl> |} ===userdateformat=== {{DPL parameter |name = userdateformat |purpose= Define a special layout for date formatting. }} Syntax: {{DPL syntax|userdateformat=''formatstring''}} The ''formatstring'' may contain letters like "y,Y,m,M,d,D,h,H,i,I,s" for year, month day. Other characters are printed as they are. See the documentation for php function date() for more details [http://www.php.net/manual/en/function.date.php]. The ''userdateformat'' applies to all date/time fields, see the parameters: {{dpl3|addeditdate}},{{dpl3|addpagetoucheddate}},{{dpl3|addfirstcategorydate}}. Example: userdateformat=Y-m-d (D) Default: By default DPL uses "Y-m-d H:i:s" to display date and time. Note that MediaWiki stores all dates/times in UTC format. When displaying a time stamp DPL will translate it according to # the timezone preference (difference to UTC/GMT) given by the user in his user settings. # if no preference is given and for all anonymous users the local time on the server will be used. So you will either see a time based on your local time (browser based) or based on the timezone in which the wiki server is running. The same kind of translation applies to dates you specify when selecting articles by revsion date/time.
Summary:
Please note that all contributions to KB42 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
KB42:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
DONATE
Wiki tools
Wiki tools
Special Pages
Categories
Import Pages
Cargo data
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs