Difference between revisions of "WSU Technology Knowledge Base:Adding Dynamic Page Lists to Articles"

From WSU Technology Knowledge Base
Jump to navigation Jump to search
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
{{author}}
 +
==Overview==
 
The DynamicPageList (DPL) extension allows authors to use categories to automatically generate dynamic bullet lists of links to other wiki articles. This is an easy way to create a ''Related Links'' section in a wiki article. The lists are dynamic in that they are created each time an article loads and will automatically update depending on the configuration of this list. DPL differs from [http://www.mediawiki.org/wiki/Extension:SubPageList SubPageLists] or SPL in that categories, not sub-directories, are used to populate the lists.
 
The DynamicPageList (DPL) extension allows authors to use categories to automatically generate dynamic bullet lists of links to other wiki articles. This is an easy way to create a ''Related Links'' section in a wiki article. The lists are dynamic in that they are created each time an article loads and will automatically update depending on the configuration of this list. DPL differs from [http://www.mediawiki.org/wiki/Extension:SubPageList SubPageLists] or SPL in that categories, not sub-directories, are used to populate the lists.
 
 
*By default, DPL selects articles for inclusion based on the date and time that they were added to the category. The most recently added articles are selected. Note that this is not necessarily the same as selecting the most recently created or modified articles. This selection process can be changed by specifying a different '''ordermethod'''. Other methods include ''lastedit'', ''length'', ''created'', and ''popularity''.
 
*By default, DPL selects articles for inclusion based on the date and time that they were added to the category. The most recently added articles are selected. Note that this is not necessarily the same as selecting the most recently created or modified articles. This selection process can be changed by specifying a different '''ordermethod'''. Other methods include ''lastedit'', ''length'', ''created'', and ''popularity''.
 
*Multiple categories can be specified, resulting in a list of articles selected from those that are members of all categories listed (e.g., Graphics and Adobe). If multiple categories are specified, DPL selects the articles that were most recently added to the first category.
 
*Multiple categories can be specified, resulting in a list of articles selected from those that are members of all categories listed (e.g., Graphics and Adobe). If multiple categories are specified, DPL selects the articles that were most recently added to the first category.
 
+
==Example 1 - The Ten Articles Most Recently Added to the Internet Category==
 
 
=Example 1 - The Ten Articles Most Recently Added to the Internet Category=
 
 
 
 
This DPL displays the 10 articles that were most recently added to the Internet category. This code...
 
This DPL displays the 10 articles that were most recently added to the Internet category. This code...
 
+
<pre style="display: inline-block;">
<pre>
 
 
<DynamicPageList>
 
<DynamicPageList>
category = Intenet
+
category = Internet
 
count = 10
 
count = 10
 
</DynamicPageList>
 
</DynamicPageList>
 
</pre>
 
</pre>
 
 
...generates this list
 
...generates this list
 
 
<DynamicPageList>
 
<DynamicPageList>
 
category = Internet
 
category = Internet
Line 24: Line 19:
 
</DynamicPageList>
 
</DynamicPageList>
 
====Notes====
 
====Notes====
The only settings specified in this DPL are '''category''' and '''count'''. If a setting is omitted, it will revert to its default value. Because an '''ordermethod''' is not specified, this DPL selects articles based on when they were added to the category, the default selection process. Because the '''order''' setting is not specified, the list is presented in the default ''descending'' order. Settings can be added and modified to obtain the desired list.
+
The only settings specified in this DPL are '''category''' and '''count'''. If a setting is omitted, it will revert to its default value. Because an '''ordermethod''' is not specified, this DPL selects articles based on when they were added to the category, the default selection process. Because the '''order''' setting is not specified, the list is presented in the default ''descending'' order. Settings can be added and modified to obtain the desired result.
 
 
=Example 2 - The Five Most Popular Articles in the D2L Category=
 
  
 +
==Example 2 - The Five Most Popular Articles in the Software Category==
 
This DPL displays the five most popular articles in the D2L category based on number of hits. This code...
 
This DPL displays the five most popular articles in the D2L category based on number of hits. This code...
 
+
<pre style="display: inline-block;">
<pre>
 
 
<DynamicPageList>
 
<DynamicPageList>
category = D2L
+
category = Software
 
count = 5
 
count = 5
 
ordermethod = popularity
 
ordermethod = popularity
 
</DynamicPageList>
 
</DynamicPageList>
 
</pre>
 
</pre>
 
 
...generates this list
 
...generates this list
 
 
<DynamicPageList>
 
<DynamicPageList>
category = D2L
+
category = Software
 
count = 5
 
count = 5
 
ordermethod = popularity
 
ordermethod = popularity
Line 47: Line 38:
 
====Notes====
 
====Notes====
 
In this example, the '''ordermethod''' ''popularity'' is used, overriding the default '''ordermethod'''.
 
In this example, the '''ordermethod''' ''popularity'' is used, overriding the default '''ordermethod'''.
 
+
==Example 3 - The Five Most Recently Created Articles in the Faculty and Network Categories==
=Example 3 - The Five Most Recently Created Articles in the Faculty and Network Categories=
 
 
 
 
This DPL displays the five most recently created articles added to both the Faculty and Network categories. This code...
 
This DPL displays the five most recently created articles added to both the Faculty and Network categories. This code...
 
 
<pre>
 
<pre>
 
<DynamicPageList>
 
<DynamicPageList>
Line 58: Line 46:
 
count = 5
 
count = 5
 
ordermethod = created
 
ordermethod = created
order = descending
 
 
addfirstcategorydate = ymd
 
addfirstcategorydate = ymd
 
</DynamicPageList>
 
</DynamicPageList>
 
</pre>
 
</pre>
 
 
...generates this list
 
...generates this list
 
 
<DynamicPageList>
 
<DynamicPageList>
 
category = Faculty
 
category = Faculty
Line 70: Line 55:
 
count = 5
 
count = 5
 
ordermethod = created
 
ordermethod = created
order = descending
 
 
addfirstcategorydate = ymd
 
addfirstcategorydate = ymd
 
</DynamicPageList>
 
</DynamicPageList>
 
====Notes====
 
====Notes====
 
In this example, the '''ordermethod''' is ''created''. If multiple categories are specified, the '''ordermethod''' is applied to the first category. Thus, this DPL selects the most recently created articles in the Faculty category that are also in the Network category. The '''addfirstcategorydate''' setting controls the format of the date information preceding each article link. The value can be ''true'' (display date), ''false'' (default, don't display date), or a date specifier (''ymd'', ''md'', ''dm'', ''dmy'', ''mdy'', and ''ISO 8601''). If the setting is omitted, the date is not displayed. If multiple categories are specified, it will always display the date that the article was added to the first category. Note that the date displayed is always the date that the article was added to the category, regardless of the '''ordermethod''' selected.
 
In this example, the '''ordermethod''' is ''created''. If multiple categories are specified, the '''ordermethod''' is applied to the first category. Thus, this DPL selects the most recently created articles in the Faculty category that are also in the Network category. The '''addfirstcategorydate''' setting controls the format of the date information preceding each article link. The value can be ''true'' (display date), ''false'' (default, don't display date), or a date specifier (''ymd'', ''md'', ''dm'', ''dmy'', ''mdy'', and ''ISO 8601''). If the setting is omitted, the date is not displayed. If multiple categories are specified, it will always display the date that the article was added to the first category. Note that the date displayed is always the date that the article was added to the category, regardless of the '''ordermethod''' selected.
 
+
==Example 4 - The 15 Most Recently Updated Articles in the D2L Category, Listed in Columns==
=Example 4 - The 15 Most Recently Updated Articles in the D2L Category, Listed in Columns=
 
 
 
 
If a DPL returns a long list of article links, it may be easier for the reader if the list is arranged in columns. This can be accomplished using a table and the '''offset''' DPL setting. This code...
 
If a DPL returns a long list of article links, it may be easier for the reader if the list is arranged in columns. This can be accomplished using a table and the '''offset''' DPL setting. This code...
 
 
<pre>
 
<pre>
 
<table><tr>
 
<table><tr>
Line 87: Line 68:
 
count = 5
 
count = 5
 
ordermethod = lastedit
 
ordermethod = lastedit
order = descending
 
 
</DynamicPageList>
 
</DynamicPageList>
 
</td>
 
</td>
Line 96: Line 76:
 
count = 5
 
count = 5
 
ordermethod = lastedit
 
ordermethod = lastedit
order = descending
 
 
</DynamicPageList>
 
</DynamicPageList>
 
</td>
 
</td>
Line 105: Line 84:
 
count = 5
 
count = 5
 
ordermethod = lastedit
 
ordermethod = lastedit
order = descending
 
 
</DynamicPageList>
 
</DynamicPageList>
 
</td>
 
</td>
 
</tr></table>
 
</tr></table>
 
</pre>
 
</pre>
 
 
...generates this list
 
...generates this list
 
 
<table><tr>
 
<table><tr>
 
<td>
 
<td>
Line 119: Line 95:
 
count = 5
 
count = 5
 
ordermethod = lastedit
 
ordermethod = lastedit
order = descending
 
 
</DynamicPageList>
 
</DynamicPageList>
 
</td>
 
</td>
Line 128: Line 103:
 
count = 5
 
count = 5
 
ordermethod = lastedit
 
ordermethod = lastedit
order = descending
 
 
</DynamicPageList>
 
</DynamicPageList>
 
</td>
 
</td>
Line 137: Line 111:
 
count = 5
 
count = 5
 
ordermethod = lastedit
 
ordermethod = lastedit
order = descending
 
 
</DynamicPageList>
 
</DynamicPageList>
 
</td>
 
</td>
 
</tr></table>
 
</tr></table>
 
====Notes====
 
====Notes====
In this example, three DPLs are organized in a three-column table. Each DPL is requesting a list of five articles from the same '''category''' (''D2L'') using the same '''ordermethod''' (''lastedit'') and '''order''' (''descending''). In other words, they are all requesting five articles from the same underlying list. Normally, this would result in three identical lists (i.e., the top five articles). The '''offset''' setting tells the DPL to display the articles beginning with the article in the list position that immediately follows the offset value. For example, an '''offset''' value of ''5'' tells the DPL to begin displaying articles starting with the sixth article on the list. If the '''offset''' value is ''10'', the list would start with the eleventh article. In this example, the first DPL lists the first five articles, the second specifies an '''offset''' value of ''5'' and thus lists articles 6 through 10, and the third specifies an '''offset''' value of ''10'' and thus lists articles 11 through 15. In order for the '''offset''' setting to work correctly, each of the DPLs needs to have the same '''ordermethod''' and '''order'''. Also, the '''offset''' setting only works for DPLs that are pulling from a list of articles that exceed the offset value. For example, if there are only four articles in the category, an offset value of 4 or greater would result in an empty list.
+
In this example, three DPLs are organized in a three-column table. Each DPL is requesting a list of five articles from the same '''category''' (''D2L'') using the same '''ordermethod''' (''lastedit'') and '''order''' (''descending'' by default). In other words, they are all requesting five articles from the same underlying list. Normally, this would result in three identical lists (i.e., the top five articles). The '''offset''' setting tells the DPL to display the articles beginning with the article in the list position that immediately follows the offset value. For example, an '''offset''' value of ''5'' tells the DPL to begin displaying articles starting with the sixth article on the list. If the '''offset''' value is ''10'', the list would start with the eleventh article. In this example, the first DPL lists the first five articles, the second specifies an '''offset''' value of ''5'' and thus lists articles 6 through 10, and the third specifies an '''offset''' value of ''10'' and thus lists articles 11 through 15. In order for the '''offset''' setting to work correctly, each of the DPLs needs to have the same '''ordermethod''' and '''order'''. Also, the '''offset''' setting only works for DPLs that are pulling from a list of articles that exceed the offset value. For example, if there are only four articles in the category, an offset value of 4 or greater would result in an empty list.
 
 
 
==Related Links==
 
==Related Links==
 
*[http://www.mediawiki.org/wiki/Extension:DynamicPageList_%28Wikimedia%29 DynamicPageList Extension Homepage]
 
*[http://www.mediawiki.org/wiki/Extension:DynamicPageList_%28Wikimedia%29 DynamicPageList Extension Homepage]
 +
[[Category:Author]][[Category:List]]

Latest revision as of 01:45, 18 August 2012

Wiki Author Series
Author series pic.jpg
This article is part of the

Wiki Author Series

Overview

The DynamicPageList (DPL) extension allows authors to use categories to automatically generate dynamic bullet lists of links to other wiki articles. This is an easy way to create a Related Links section in a wiki article. The lists are dynamic in that they are created each time an article loads and will automatically update depending on the configuration of this list. DPL differs from SubPageLists or SPL in that categories, not sub-directories, are used to populate the lists.

  • By default, DPL selects articles for inclusion based on the date and time that they were added to the category. The most recently added articles are selected. Note that this is not necessarily the same as selecting the most recently created or modified articles. This selection process can be changed by specifying a different ordermethod. Other methods include lastedit, length, created, and popularity.
  • Multiple categories can be specified, resulting in a list of articles selected from those that are members of all categories listed (e.g., Graphics and Adobe). If multiple categories are specified, DPL selects the articles that were most recently added to the first category.

Example 1 - The Ten Articles Most Recently Added to the Internet Category

This DPL displays the 10 articles that were most recently added to the Internet category. This code...

<DynamicPageList>
category = Internet
count = 10
</DynamicPageList>

...generates this list

Notes

The only settings specified in this DPL are category and count. If a setting is omitted, it will revert to its default value. Because an ordermethod is not specified, this DPL selects articles based on when they were added to the category, the default selection process. Because the order setting is not specified, the list is presented in the default descending order. Settings can be added and modified to obtain the desired result.

Example 2 - The Five Most Popular Articles in the Software Category

This DPL displays the five most popular articles in the D2L category based on number of hits. This code...

<DynamicPageList>
category = Software
count = 5
ordermethod = popularity
</DynamicPageList>

...generates this list

Notes

In this example, the ordermethod popularity is used, overriding the default ordermethod.

Example 3 - The Five Most Recently Created Articles in the Faculty and Network Categories

This DPL displays the five most recently created articles added to both the Faculty and Network categories. This code...

<DynamicPageList>
category = Faculty
category = Network
count = 5
ordermethod = created
addfirstcategorydate = ymd
</DynamicPageList>

...generates this list

  • <span class="mw-formatted-date" title="2012-02-09">2012 February 9</span>: Class storage

Notes

In this example, the ordermethod is created. If multiple categories are specified, the ordermethod is applied to the first category. Thus, this DPL selects the most recently created articles in the Faculty category that are also in the Network category. The addfirstcategorydate setting controls the format of the date information preceding each article link. The value can be true (display date), false (default, don't display date), or a date specifier (ymd, md, dm, dmy, mdy, and ISO 8601). If the setting is omitted, the date is not displayed. If multiple categories are specified, it will always display the date that the article was added to the first category. Note that the date displayed is always the date that the article was added to the category, regardless of the ordermethod selected.

Example 4 - The 15 Most Recently Updated Articles in the D2L Category, Listed in Columns

If a DPL returns a long list of article links, it may be easier for the reader if the list is arranged in columns. This can be accomplished using a table and the offset DPL setting. This code...

<table><tr>
<td>
<DynamicPageList>
category = D2L
count = 5
ordermethod = lastedit
</DynamicPageList>
</td>
<td>
<DynamicPageList>
category=D2L
offset = 5
count = 5
ordermethod = lastedit
</DynamicPageList>
</td>
<td>
<DynamicPageList>
category = D2L
offset = 10
count = 5
ordermethod = lastedit
</DynamicPageList>
</td>
</tr></table>

...generates this list

No pages meet these criteria.

No pages meet these criteria.

No pages meet these criteria.

Notes

In this example, three DPLs are organized in a three-column table. Each DPL is requesting a list of five articles from the same category (D2L) using the same ordermethod (lastedit) and order (descending by default). In other words, they are all requesting five articles from the same underlying list. Normally, this would result in three identical lists (i.e., the top five articles). The offset setting tells the DPL to display the articles beginning with the article in the list position that immediately follows the offset value. For example, an offset value of 5 tells the DPL to begin displaying articles starting with the sixth article on the list. If the offset value is 10, the list would start with the eleventh article. In this example, the first DPL lists the first five articles, the second specifies an offset value of 5 and thus lists articles 6 through 10, and the third specifies an offset value of 10 and thus lists articles 11 through 15. In order for the offset setting to work correctly, each of the DPLs needs to have the same ordermethod and order. Also, the offset setting only works for DPLs that are pulling from a list of articles that exceed the offset value. For example, if there are only four articles in the category, an offset value of 4 or greater would result in an empty list.

Related Links