Template:Link/Desc/Doc

From PCSAR

(Difference between revisions)
Jump to: navigation, search
(New page: {{Template:Link/Doc/Related}} {{Template Doc|<nowiki>Page|Text|Desc=description</nowiki>}} is used to create a link to a page. ; Page : the page to link to ; Text : (optional) the text to...)
Line 1: Line 1:
{{Template:Link/Doc/Related}}
{{Template:Link/Doc/Related}}
-
{{Template Doc|<nowiki>Page|Text|Desc=description</nowiki>}}
+
{{Template doc|<nowiki>Page|RevisionID=id|PageNum=number|Text|Desc=description</nowiki>}}
is used to create a link to a page.
is used to create a link to a page.
; Page : the page to link to
; Page : the page to link to
 +
; RevisionID : (optional) The revision to link to. This is used to link to an old version of an existing page. Revision ID's can be found on the "history" tab of the page in question, as "oldid". Revision ID's are unique across all pages, so the Revision ID also specifies the Page. If the Revision ID is provided, the Page does not need to be specified unless it is to provide the link text.
 +
; PageNum : (optional) if Page is a file that supports multiple internal pages, this parameter will link to the specified internal page
; Text : (optional) the text to display as the link
; Text : (optional) the text to display as the link
-
; Desc : (optional) the text to display as the link if the page does not description and ''Text'' is not supplied. There is no point to specifying both ''Text'' and ''Desc''.
+
; Desc : (optional) the text to display as the link if the page does not have a description and ''Text'' is not supplied. There is no point to specifying both ''Text'' and ''Desc''.
This template's purpose is very similar to creating links with double square brackets.
This template's purpose is very similar to creating links with double square brackets.
-
The benefit of using <code>{{((}}link|</code>
+
The benefit of using <code>{{((}}Link/Desc|</code>
is that, the page itself may specify a description using [[Template:desc]], etc.
is that, the page itself may specify a description using [[Template:desc]], etc.
 +
(Using the [[Property:Page description]].)
That description can be displayed as the link text.
That description can be displayed as the link text.
Just like with double square brackets, if you have preferred text for the link, you can provide it.
Just like with double square brackets, if you have preferred text for the link, you can provide it.
Line 41: Line 44:
-
Using ''Desc:''
+
Using <code>Desc</code>:
{{demo table|
{{demo table|
{{demo row|<nowiki>{{Link/Desc|Demo/Page with description|Desc=this page}}</nowiki>|<!--
{{demo row|<nowiki>{{Link/Desc|Demo/Page with description|Desc=this page}}</nowiki>|<!--
Line 51: Line 54:
{{demo row|<nowiki>{{Link/Desc|Demo/Page without description|That Page|Desc=this page}}</nowiki>|<!--
{{demo row|<nowiki>{{Link/Desc|Demo/Page without description|That Page|Desc=this page}}</nowiki>|<!--
-->{{Link/Desc|Demo/Page without description|That Page|Desc=this page}} }}
-->{{Link/Desc|Demo/Page without description|That Page|Desc=this page}} }}
 +
}}
 +
 +
Using <code>RevisionID</code>:
 +
{{demo table|
 +
{{demo row|<nowiki>{{Link/Desc|RevisionID=1}}</nowiki>|<!--
 +
-->{{Link/Desc|RevisionID=1}} }}
 +
{{demo row|<nowiki>{{Link/Desc|Main Page|RevisionID=1}}</nowiki>|<!--
 +
-->{{Link/Desc|Main Page|RevisionID=1}} }}
 +
{{demo row|<nowiki>{{Link/Desc|Main Page|main|RevisionID=1}}</nowiki>|<!--
 +
-->{{Link/Desc|Main Page|main|RevisionID=1}} }}
 +
}}
 +
 +
Using <code>PageNum</code>:
 +
{{demo table|
 +
{{demo row|<nowiki>{{Link/Desc|Main Page|PageNum=2}}</nowiki>|<!--
 +
-->{{Link/Desc|Main Page|PageNum=2}} }}
}}
}}
Line 56: Line 75:
Helper templates:
Helper templates:
* [[Template:Link/Desc/Text]]
* [[Template:Link/Desc/Text]]
 +
* [[Template:Link/Desc/Core]]
 +
* [[Template:Link/Desc/CoreText]]
 +
Icons:
 +
* {{link|File:Calendar-miniscule-icon.png}}

Revision as of 05:58, 18 September 2015

Related Templates
Link/Create Create from template
Link/Desc Use page's description
Link/Create+Desc Combine Link/Create and Link/Desc
Link Default; same as Link/Desc

The template {{Link/Desc|Page|RevisionID=id|PageNum=number|Text|Desc=description}} is used to create a link to a page.

Page 
the page to link to
RevisionID 
(optional) The revision to link to. This is used to link to an old version of an existing page. Revision ID's can be found on the "history" tab of the page in question, as "oldid". Revision ID's are unique across all pages, so the Revision ID also specifies the Page. If the Revision ID is provided, the Page does not need to be specified unless it is to provide the link text.
PageNum 
(optional) if Page is a file that supports multiple internal pages, this parameter will link to the specified internal page
Text 
(optional) the text to display as the link
Desc 
(optional) the text to display as the link if the page does not have a description and Text is not supplied. There is no point to specifying both Text and Desc.

This template's purpose is very similar to creating links with double square brackets. The benefit of using {{Link/Desc| is that, the page itself may specify a description using Template:desc, etc. (Using the Property:Page description.) That description can be displayed as the link text. Just like with double square brackets, if you have preferred text for the link, you can provide it. While Text is higher priority than the page's own description, Desc is lower priority.

For illustration purpose, the following demonstration pages have been set up:


You type... You get...
{{Link/Desc|Demo/Page with description}} 
Described page
{{Link/Desc|Demo/Page without description}} 
Page without description
{{Link/Desc|Demo/Page with description|this page}} 
this page
{{Link/Desc|Demo/Page without description|this page}} 
this page


Here's how it would work if you had used square brackets instead. (The difference between this table and the previous one is only in the first case.)

You type... You get...
[[Demo/Page with description]] 
Demo/Page with description
[[Demo/Page without description]] 
Demo/Page without description
[[Demo/Page with description|this page]] 
this page
[[Demo/Page without description|this page]] 
this page


Using Desc:

You type... You get...
{{Link/Desc|Demo/Page with description|Desc=this page}} 
Described page
{{Link/Desc|Demo/Page without description|Desc=this page}} 
this page
{{Link/Desc|Demo/Page with description|That Page|Desc=this page}} 
That Page
{{Link/Desc|Demo/Page without description|That Page|Desc=this page}} 
That Page


Using RevisionID:

You type... You get...
{{Link/Desc|RevisionID=1}} 
linklink=
{{Link/Desc|Main Page|RevisionID=1}} 
Main Pagelink=
{{Link/Desc|Main Page|main|RevisionID=1}} 
mainlink=


Using PageNum:

You type... You get...
{{Link/Desc|Main Page|PageNum=2}} 
Main Page


Implementation

Helper templates:

Icons: