Template:List subpages: Difference between revisions

From FrathWiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>{{#dpl:
<dpl>
|{{{parameter|{{{1}}}}}}={{{value|{{{2}}}}}}
category | namespace | titlematch | linksto | uses | createdby | modifiedby | lastmodifiedby=YOUR CRITERION
|replaceintitle=#^{{{exclude|{{{3}}}}}}(.+?)$#,\1
replaceintitle=#^PATTERN-TO-BE-EXCLUDED/(.+?)$#,\1
|mode=userformat
mode=userformat
|listseparators=,\n* [[%PAGE%{{!}}{{#if: {{{namespace|{{{4|}}}}}} | {{{namespace|{{{4|}}}}}}:}}%TITLE%]],,
listseparators=,\n* [[%PAGE%|%TITLE%]],,
|namespace={{{namespace|{{{4|}}}}}}
notnamespace=Talk
}}</includeonly><noinclude>
</dpl>
 
</includeonly>
==Usage==
<noinclude>
To use this template write <code><nowiki>{{subst:List subpages}}</nowiki></code> where you want the list to go, save the page and edit it again. 


'''N.B.''' After the first save DPL will give an errer about invalid parameters.  This is to be expected because you have to replace some
<pre><nowiki>
{{List subpages|
|parameter=titlematch
|value=Main page%
|exclude=Main page/
|namespace=
}}


Edit the first line after <code><nowiki><dpl></nowiki></code> into a DPL selection criterion which makes sense in your context like <code>titlematch=MainPage%</code> or <code>category=''an existing category''</code>, and replace <code>Main Page</code> in the <code>replaceintitle=</code> parameter argument by the part you want excluded in your link text — typically the superpage name. Don't forget that the following slash must be included in the pattern!
or


<pre><nowiki>
{{List subpages|titlematch|Main Page%|Main Page/}}
<dpl>
category | namespace | titlematch | linksto | uses | createdby | modifiedby | lastmodifiedby=your criterion
replaceintitle=#^Main Page/(.+?)$#,\1 <-- replaceintitle
mode=userformat
listseparators=,\n* [[%PAGE%|%TITLE%]],,
notnamespace=Talk
</dpl>
</nowiki></pre>
</nowiki></pre>
The
== Purpose ==


The purpose of this template is to can the DPL statements necessary to get a list like  
The purpose of this template is to can the DPL statements necessary to get a list like  


<dpl>
{{list subpages|titlematch|Main Page%|Main Page/}}
replaceintitle=#^Main Page/(.+?)$#,\1
mode=userformat
listseparators=,\n* [[%PAGE%|%TITLE%]],,
</dpl>


rather than  
rather than  
Line 40: Line 37:
</dpl>
</dpl>


when the search criterion returns a list of subpages, so it makes sense only when you know that the page(s) returned by the search criterion is a list of subpages.</noinclude>
when a DPL search criterion returns a list of subpages, so it makes sense only when you know that the page(s) returned by the search criterion is a list of subpages.
 
== List another namespace ==
 
By default only pages from the main namespace are included.  If you want to list pages from another namespace pass a named parameter <code>namespace=''namespace''</code>.
 
<pre><nowiki>
{{List subpages|
|parameter=titlematch
|value=Main page%
|exclude=Main page/
|namespace=Talk
}}
 
or
 
{{List subpages|titlematch|Main Page%|Main Page/|Talk|Talk:}}
</nowiki></pre>
 
{{List subpages|titlematch|Main Page%|Main Page/|Talk|Talk:}}
 
</noinclude>

Latest revision as of 05:52, 2 July 2009


Usage

{{List subpages|
|parameter=titlematch
|value=Main page%
|exclude=Main page/
|namespace=
}}

or

{{List subpages|titlematch|Main Page%|Main Page/}}

The

Purpose

The purpose of this template is to can the DPL statements necessary to get a list like

{{#dpl: |titlematch=Main Page% |replaceintitle=#^Main Page/(.+?)$#,\1 |mode=userformat |listseparators=,\n* %TITLE%,, |namespace= }}

rather than

<dpl> titlematch=Main Page% notnamespace=Talk </dpl>

when a DPL search criterion returns a list of subpages, so it makes sense only when you know that the page(s) returned by the search criterion is a list of subpages.

List another namespace

By default only pages from the main namespace are included. If you want to list pages from another namespace pass a named parameter namespace=namespace.

{{List subpages|
|parameter=titlematch
|value=Main page%
|exclude=Main page/
|namespace=Talk
}}

or

{{List subpages|titlematch|Main Page%|Main Page/|Talk|Talk:}}

{{#dpl: |titlematch=Main Page% |replaceintitle=#^Main Page/(.+?)$#,\1 |mode=userformat |listseparators=,\n* Talk:%TITLE%,, |namespace=Talk }}