Jump to content

Template:Links-core: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
+ example output for dependant templates
m move documentation to subpage
Line 1: Line 1:
<span class="plainlinks">{{#if:{{{link|}}}|[[{{{1|}}}:{{{2|template}}}:{{{3|foo}}}]]}} (<small> {{#if:{{{talk|}}}|[[{{{1|}}}:{{{2|template}}} talk:{{{3|foo}}}|talk]]}} {{#if:{{{edit|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=edit}} edit]}} {{#if:{{{watch|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=watch}} watch]}} {{#if:{{{contribs|}}}|{{#ifeq:{{lc:{{{2|template}}}}}|user|[[{{{1|}}}:Special:Contributions/{{#titleparts:{{{3|foo}}}|1}}|contribs]]}}}} {{#if:{{{history|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=history}} history]}} {{#if:{{{whatlinkshere|}}}|[{{fullurl:{{{1|}}}:Special:Whatlinkshere/{{{2|template}}}:{{{3|foo}}}|limit=1000}} links]}} {{#if:{{{logs|}}}|[{{fullurl:{{{1|}}}:Special:Log|page={{urlencode:{{{2|template}}}:{{{3|foo}}}}}}} logs]}} {{#if:{{{localspace|}}}|[[{{{1|}}}:Special:Prefixindex/{{{2|template}}}:{{{3|foo}}}|localspace]]}} {{#if:{{{delete|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=delete}} delete]}} {{#if:{{{block|}}}|{{#ifeq:{{lc:{{{2|template}}}}}|user|[[{{{1|}}}:Special:Blockip/{{#titleparts:{{{3|foo}}}|1}}|block]]}}}} </small>)</span><noinclude>
<span class="plainlinks">{{#if:{{{link|}}}|[[{{{1|}}}:{{{2|template}}}:{{{3|foo}}}]]}} (<small> {{#if:{{{talk|}}}|[[{{{1|}}}:{{{2|template}}} talk:{{{3|foo}}}|talk]]}} {{#if:{{{edit|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=edit}} edit]}} {{#if:{{{watch|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=watch}} watch]}} {{#if:{{{contribs|}}}|{{#ifeq:{{lc:{{{2|template}}}}}|user|[[{{{1|}}}:Special:Contributions/{{#titleparts:{{{3|foo}}}|1}}|contribs]]}}}} {{#if:{{{history|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=history}} history]}} {{#if:{{{whatlinkshere|}}}|[{{fullurl:{{{1|}}}:Special:Whatlinkshere/{{{2|template}}}:{{{3|foo}}}|limit=1000}} links]}} {{#if:{{{logs|}}}|[{{fullurl:{{{1|}}}:Special:Log|page={{urlencode:{{{2|template}}}:{{{3|foo}}}}}}} logs]}} {{#if:{{{localspace|}}}|[[{{{1|}}}:Special:Prefixindex/{{{2|template}}}:{{{3|foo}}}|localspace]]}} {{#if:{{{delete|}}}|[{{fullurl:{{{1|}}}:{{{2|template}}}:{{{3|foo}}}|action=delete}} delete]}} {{#if:{{{block|}}}|{{#ifeq:{{lc:{{{2|template}}}}}|user|[[{{{1|}}}:Special:Blockip/{{#titleparts:{{{3|foo}}}|1}}|block]]}}}} </small>)</span><noinclude>
{{doc}}
----
==Documentation==
===Usage===
This template is not intended to be used directly. It contains the complex programming for custom link templates which can selectively show relevant links. For example, <code><nowiki>{{links-core||template|foo|talk=1}}</nowiki></code> will only output a link to the talk page.

The syntax is:
<pre>{{links-core|interwiki prefix (blank for current wiki)|namespace|page name|named option}}</pre>

Referring to the table of options below, a new links template can be created by adding "1" (or any value) beside the desired link options.
<pre>
{{links-core
|1 = {{#if:{{{3|}}}|{{{1|}}}}}
|2 = {{#if:{{{3|}}}|{{{2|template}}}|{{{1|template}}}}}
|3 = {{#if:{{{3|}}}|{{{3|foo}}}|{{{2|foo}}}}}
|link =
|talk =
|edit =
|watch =
|history =
|whatlinkshere =
|logs =
|localspace =
|delete =
|contribs =
|block =
}}
</pre>

The following link options are possible:
{| class="prettytable"
|-
! Parameter
! Example & notes
|-
|colspan="2"| '''All namespaces'''
|-
| link
| "[[template:foo]]"; a link to the relevant page.
|-
| talk
| "[[template talk:foo|talk]]"; a link to the associated talk page (will not work correctly if the template is used for a talk page).
|-
| edit
| "[{{fullurl:template:foo|action=edit}} edit]"; a link to the edit mode for that page.
|-
| watch
| "[{{fullurl:template:foo|action=watch}} watch]"; click to [[Help:Watching pages|watch]] the page.
|-
| history
| "[{{fullurl:template:foo|action=history}} history]"; link to the edit log for that page.
|-
| whatlinkshere
| "[{{fullurl:Special:Whatlinkshere/template:foo|limit=1000}} links]"; link to list of incoming links for that page.
|-
| logs
| "[{{fullurl:Special:Log|page=template:foo}} logs]"; link to all logs for the current page.
|-
| localspace
| "[[Special:Prefixindex/template:foo|localspace]]"; link to list of subpages.
|-
| delete
| "[{{fullurl:template:foo|action=delete}} delete]"; link to delete form with the page title filled in.
|-
| colspan="2"| '''User namespace'''
|-
| contribs
| "[[Special:Contributions/foo|contributions]]"; link to the user's edit log.
|-
| block
| "[[Special:Blockip/foo|block]]"; link to the block form with the user name filled in.
|}

===See also===
* Shortcut templates
** {{links-small|template|links}}
** {{links-small|template|links-small}}

[[Category:Link templates|I{{PAGENAME}}]]
</noinclude>
</noinclude>

Revision as of 08:16, 1 March 2009

( )

Template documentation

Usage

This template is not intended to be used directly. It contains the complex programming for custom link templates which can selectively show relevant links. For example, {{links-core||template|foo|talk=1}} will only output a link to the talk page.

The syntax is:

{{links-core|interwiki prefix (blank for current wiki)|namespace|page name|named option}}

Referring to the table of options below, a new links template can be created by adding "1" (or any value) beside the desired link options.

{{links-core
 |1 = {{#if:{{{3|}}}|{{{1|}}}}}
 |2 = {{#if:{{{3|}}}|{{{2|template}}}|{{{1|template}}}}}
 |3 = {{#if:{{{3|}}}|{{{3|foo}}}|{{{2|foo}}}}}
 |link          =
 |talk          =
 |edit          =
 |watch         = 
 |history       =
 |whatlinkshere = 
 |logs          =
 |localspace    =
 |delete        =
 |contribs      =
 |block         =
}}

The following link options are possible:

Parameter Example & notes
All namespaces
link "template:foo"; a link to the relevant page.
talk "talk"; a link to the associated talk page (will not work correctly if the template is used for a talk page).
edit "edit"; a link to the edit mode for that page.
watch "watch"; click to watch the page.
history "history"; link to the edit log for that page.
whatlinkshere "links"; link to list of incoming links for that page.
logs "logs"; link to all logs for the current page.
localspace "localspace"; link to list of subpages.
delete "delete"; link to delete form with the page title filled in.
User namespace
contribs "contributions"; link to the user's edit log.
block "block"; link to the block form with the user name filled in.

See also