Creating page lists with DPL3
-
- Last edited 4 years ago by MLR
-
-
- This page is a draft but has an approved version
The extension DynamicPageList3 allows you to include lists of wiki pages on any content page.
Contents
Application examples
You can view a documentation of all selection criteria and formatting options at Gamepedia.
This help page contains some examples of typical applications for this extension as well as a list of common parameters and their values.
List of subpages
The following code shows the subpages of the current page in a 3-column layout:
{{#dpl:
|titlematch={{PAGENAME}}/%
|shownamespace=false
|replaceintitle=/{{PAGENAME}}\//,
|columns=3
|mode=none
|rowcolformat=width=100%
}}
Example: Display the subpages of the page VisualEditor imn the namespace Manual in a 1-column layout:
{{#dpl:
|titlematch=VisualEditor/%
|shownamespace=false
|namespace= Manual
|replaceintitle=/VisualEditor\//,
|columns=1
|mode=ubordered
|rowcolformat=width=100%
}}
Output:
Selecting pages by namespace
{{#dpl:
|namespace=Manual
|includesubpages=true
|shownamespace=false
|count=5
|ordermethod=title
}}
Output:
- Admin Manual Introduction
- Archive/Extension/DocumentManager
- Archive:Extension/RatedComments
- BlueSpice Layout
- BlueSpice Layout/Footer
Selecting pages by category
{{#dpl:
|category=QM
|addcategories = true
|includesubpages=true
|shownamespace=false
|count=5
|ordermethod=title
|mode=ordered
}}
Output:
Extension:DynamicPageList (DPL), version 3.3.2: Warning: No results.
Selecting pages with specific naming patterns
{{#dpl:
|namespace=File
|titlematch=A%
|count=5
}}
Output:
Show a random page in a category
<div style="border:2px solid #f6f6f6; padding:10px; width:500px; height:500px; overflow:auto;">
{{#dpl:
|category=Customization
|randomcount=1
|includepage=*
|includemaxlength=10
|format=,\n==[[%PAGE%]]==\n,,}}
</div>
Output:
Error messages
The wiki contains a number of system error messages. These messages can be customized to your needs.
For example, if a wiki has a lot of visitors with anonymous read-access only, these visitors get a permissions error when they try to access a page that does not exist:
This creates the impression that a page with that name exists, but the visitor does not have sufficient rights to view the page. In reality, the page simply does not exist and a user with write-permissions could now log in and create the page.
Therefore, we want to distinguish between anonymous visitors and users with write-access and show a tailored error message.
Creating a custom 404 error page
If a page does not exist yet, you can display a custom message.
To create the message:
- Create the page MediaWiki:Noarticletext-nopermission
- Add your custom message in edit mode.
- Save the page.
- To test the message, try to access a page that does not exist.Make sure you are not logged in, because this message is displayed to anonymous users only.
How to update an error message
The text for the error pages on the wiki is stored in the form of system notifications. You can access these error messages from the page Special:AllMessages
.
To find the message or the messages that are being used on a particular error page, add ?uselang=qqx
or, if the url already contains a question mark, &uselang=qqx
to the page url:
This will expose the actual sources for the error messages on the page:
In the above example, there are two error messages on the page:
- permissionserrortext-withaction: displays the text "You do not have permission to edit this page, for the following reason"
- badaccess-groups: displays the text "The action you have requested is limited to users in one of the groups: Administrators, Editors, Reviewers.
These pages do not actually exist, and therefore the standard text message from the database is displayed. If you want to change a message, you must first create the page.
To update a system message:
- Go to the special page "System messages" (
Special:AllMessages
) - Enter the full name of the system message in the "Prefix" field of the filter: The link to the system message apears in red.
- Click on the name to create a page for this system message
- Enter your custom error message and save the page. The system message has now been customized.
- Continue to update any other system messages on the page.
Note: Many of these messages use parameters (e.g., "$1"), which should be considered when you change the default text. If something went wrong, you can also delete the custom error pages you created - then the default text from the database will be used again.
Related info
List of common parameters
Criteria for page selection
Parameter | Syntax | Description |
---|---|---|
category | |category=QM|Setup... | Pages in the category QM OR Setup |
|category=QM&Setup&... | Pages in the categories QM AND Setup | |
|category=QM|Setup...|category=Admin | Pages in the categories QM OR Setup, and pages in the category Admin | |
notcategory | |notcategory=QM | Pages that are not in the category QM |
categoriesminmax | |category=QM|categoriesminmax=2 | Pages that are in the category QM and in at least 2 more categories |
|category=QM|categoriesminmax=,1 | Pages that are only in the category QM and in no other category | |
namespace | |namespace= | Pages in the namespace (Main) |
|namespace=Help|Manual | Pages in the namespace Help OR Manual | |
namespacenot | |namespacenot=Help | Pages that are not in the namespace Help |
|namespacenot={{NAMESPACE}} | Pages that are not in the namespace of the current wiki page |
Output-Format
Parameter | Syntax | Description |
---|---|---|
mode | |mode=ordered | Unordered list |
|mode=unordered | Numbered list | |
|mode=none | Line breaks | |
|mode=category | Pages are grouped alphabetically with a letter heading (similar to category pages) | |
|mode=inline|inlinetext= • | Page names are listed on the same line and separated with a bullet point |
Sorting
Parameter | Syntax | Description |
---|---|---|
ordermethod | |ordermethod=title | Ordered by page (prefix+)title |
|ordermethod=titlewithoutnamespace | Ordered by page name independent of namespace | |
|ordermethod=counter | Ordered by number of page views (popularity) | |
|ordermethod=size | Ordered by page size | |
|ordermethod=firstedit | Ordered by creation date | |
|ordermethod=lastedit | Ordered by last edit date | |
|ordermethod=user,firstedit | Ordered by author, then by creation date | |
|ordermethod=user,lastedit | Ordered by last editor, then by last edit date | |
order | |order=ascending | Sorted in ascending order |
|order=descending | Sorted in descending order |
Display of meta data
Parameter | Syntax | Description |
---|---|---|
addcategories | |addcategories=true | Shows all categories of a page after the page name |
addpagecounter | |category:QM|ordermethod=counter|order=descending
|addpagecounter=true|count=5 |
Shows the 5 most popular pages in the category QM |
adduser | |category=QM|ordermethod=lastedit|adduser=true | Adds the name of the last editor in front of the page name |
addauthor | |category=QM|addauthor=true | Adds the name of the original author in front of the page name. |