WSU Technology Knowledge Base:Adding Dynamic Page Lists to Articles

From WSU Technology Knowledge Base
Jump to navigation Jump to search
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