Examples/Parameter: showcurid (example 1): Difference between revisions
imported>FrozenPlum (This example is technically non-working, so I worked out and provided a workaround/alternative way to do the same thing, that doesn't require the parameter in question at all.) |
imported>FrozenPlum m (FrozenPlum moved page Controlling output volume/Parameter: showcurid (example 1) to Examples/Parameter: showcurid (example 1): Simplifying how things are structured) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1:
<noinclude>{{noedit}}</noinclude><!--
This is the example preloaded for testing, press "Show Preview" to see
the example working (at the bottom of the page). If you save this page,
it saves as a new section at the bottom of your '''User:Username/Sandbox'''
-->__NOTOC__
==Example==
This
▲This will output a list of pages belonging to [[:Category:Dessert examples]]; the hyperlinks to these pages will look normal (displaying their page name), but will use an additional MediaWiki parameter named '[[mw:Manual:Parameters to index.php#Page revision or version|curid]]' at the end of the URL, which contains the numeric ID of the page.
'''Notes:'''▼
* A <code>format</code> statement could be used to achieve much the same: <code>|format = ,\n* <span class="plainlinks">[²{fullurl:%PAGE%¦curid=%PAGEID%}² %PAGE%]</span></code> (observed in the [[Controlling output volume/Parameter: showcurid (example 1)#Example 2|second example]]).▼
* Using this type of link may be somewhat faster than using the title only. This kind of link is useful for some web spiders (e.g., some search engine spiders may need a unique ID within the pagelink) and it works even if the title has moved.▼
<pre>
Line 21 ⟶ 14:
</pre>
▲'''Notes:'''
==Result==▼
▲* A <code>format</code> statement could also be used to achieve
* <code>showcurid=true</code> cannot be used together with <code>openreferences=true</code>.
▲* Using this type of link may be somewhat faster than using the title only. This kind of link is useful for some web spiders (e.g., some search engine spiders may need a unique ID within the pagelink) and it works even if the title has moved.
{{tempnote}}
▲==Result==
{{#dpl:
|category = Dessert examples
Line 29 ⟶ 27:
==Example 2==
This selects pages
<pre>
Line 43 ⟶ 41:
|format = ,\n* <span class="plainlinks">[²{fullurl:%PAGE%¦curid=%PAGEID%}² %PAGE%]</span>
}}
<noinclude>
[[Category:
[[Category:Uses category parameter]]
[[Category:Uses showcurid parameter]]
|
Latest revision as of 01:14, 1 April 2023
Example
This outputs a list of pages belonging to Category:Dessert examples; the hyperlinks to these pages would look normal (displaying their page name), but would use an additional MediaWiki parameter named 'curid' at the end of the URL, which contains the numeric ID of the page.
{{#dpl: |category = Dessert examples |showcurid = true }}
Notes:
- A
format
statement could also be used to achieve (working) output:|format = ,\n* [²{fullurl:%PAGE%¦curid=%PAGEID%}² %PAGE%]
(observed in an alternate example). showcurid=true
cannot be used together withopenreferences=true
.- Using this type of link may be somewhat faster than using the title only. This kind of link is useful for some web spiders (e.g., some search engine spiders may need a unique ID within the pagelink) and it works even if the title has moved.
Result
{{#dpl: |category = Dessert examples |showcurid = true }}
Example 2
This selects pages in Category:Dessert examples, format
provides very similar functionality to showcurid
; the \n*
creates a new line with bullet, then the MediaWiki magic word {{fullurl:}}
is used to create the URL from %PAGE%
, and feed the URL the %PAGEID%
as a URL parameter external link. %PAGE%
is then used as the link text. Using a magic word (or parser function) in the {{#dpl:}}
method of using DPL3 requires special syntax, double curly {{
braces }}
must be replaced with ²{
and }²
respectively, and pipe |
characters must be replaced with ¦
or {{!}}
. The <span class="plainlinks"></span>
wraps each link with a MediaWiki class to prevent the external link icon from displaying.
{{#dpl: |category = Dessert examples |format = ,\n* <span class="plainlinks">[²{fullurl:%PAGE%¦curid=%PAGEID%}² %PAGE%]</span> }}
Result 2
{{#dpl: |category = Dessert examples |format = ,\n* [²{fullurl:%PAGE%¦curid=%PAGEID%}² %PAGE%] }}