Difference between revisions of "Template:Compare pages"

From blackwiki
Jump to navigation Jump to search
imported>Technical 13
(Before was if one OR two then... This should be if one AND two...)
imported>Technical 13
(Debugging...)
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}|{{#if:{{{2|}}}|{{Plainlinks|url={{fullurl:Special:ComparePages|{{#iferror:{{{1|}}}|page1={{#urlencode:{{{1}}}}}|rev1={{{1}}}}}|{{#iferror:{{{2|}}}|page2={{#urlencode:{{{2}}}}}|rev2={{{2}}}}}}}|name=Compare {{{1}}} and {{{2}}}}}|{{Error|Two pages are needed to compare. }}}}}}</includeonly><noinclude>
+
<includeonly>{{#if:{{{1}}}|{{#if:{{{2}}}|{{Plainlinks|url={{fullurl:Special:ComparePages|{{#iferror:{{#expr:{{{1|}}}+1}}|page1={{#urlencode:{{{1}}}}}|rev1={{{1}}}}}|{{#iferror:{{#expr:{{{2|}}}+1}}|page2={{#urlencode:{{{2}}}}}|rev2={{{2}}}}}}}|name=Compare {{{1}}} and {{{2}}}}}|{{Error|Two pages are needed to compare. }}}}|{{Error|Two pages are needed to compare. }}}}</includeonly><noinclude>
  
 
{{Documentation}}</noinclude>
 
{{Documentation}}</noinclude>

Revision as of 16:16, 20 January 2014


50px Template documentation[view] [edit] [history] [purge]

Similar to the {{Diff}} template, this template is intended to be useful for creating links to "diffs"; that is, links to pages that show the differences between two versions of a wiki page. The major difference is that {{Diff}} is intended to show two versions of the same page, and this creates a link to Special:ComparePages to show one version of two different pages.

Every version of a page has a revision ID, which you can find from the history of the page by looking at the link for the timestamp, which is of the form:

https://en.wikipedia.org/w/index.php?title=SomePageName&oldid=442212827

The number after oldid= is the revision ID.

Given a page name and one or two revision IDs, you can construct links to several types of diffs.

Usage

{{Compare pages|page or oldid for page 1|page or oldid for page 2}}
  • page – The title of the page.
  • oldid – The revision ID onto which the diff is generated.

All parameters are required. Omitting parameters will return an error.

Examples

Code Output
{{Compare pages|Foo|Bar}} Template:Plainlinks

This is the form that would be used most often.

{{Compare pages|Foo|Bar|Difference between pages}} Template:Plainlinks
{{Compare pages|Foo}} Template:Plainlinks
{{Compare pages||Bar}} Two pages are needed to compare.

See also