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
Line 21: Line 21:
 
<DynamicPageList>
 
<DynamicPageList>
 
category = D2L
 
category = D2L
count = 5
+
count = 15
 
addfirstcategorydate = ymd
 
addfirstcategorydate = ymd
 
</DynamicPageList>
 
</DynamicPageList>

Revision as of 17:14, 3 March 2012

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 Articles Most Recently Added to the Internet Category

Here is a simple example of a DPL that displays the five articles that were most recently added to the Internet category. This code...

<DynamicPageList>
category = D2L
count = 5
</DynamicPageList>

...generates this list

No pages meet these criteria.

Notes

If the ordermethod popularity is used, specify descending order.

Example 2 - 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 3 - 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 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
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

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.

Related Links