WSU Technology Knowledge Base:Adding Dynamic Page Lists to Articles
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 Five Most Popular Articles in the D2L Category
Here is a simple example of a DPL that displays the five most popular (based on number of hits) articles in the D2L category. This code...
<DynamicPageList> category = D2L count = 5 ordermethod = popularity order = descending </DynamicPageList>
...generates this list
No pages meet these criteria.
Notes
If the ordermethod popularity is used, specify descending order.
Example 2 - The Five Most Recently Created Articles in the Faculty and Network Categories
Here is another simple DPL that 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 order = descending 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 3 - The 15 Most Recently Updated Articles 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 order = descending </DynamicPageList> </td> <td> <DynamicPageList> category=D2L offset = 5 count = 5 ordermethod = lastedit order = descending </DynamicPageList> </td> <td> <DynamicPageList> category = D2L offset = 10 count = 5 ordermethod = lastedit order = descending </DynamicPageList> </td> </tr></table>
...generates this list
No pages meet these criteria. |
No pages meet these criteria. |
No pages meet these criteria. |
Notes
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. In this example, the date information is removed by setting addfirstcategorydate to false.