Template:Compare: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Zai Lynch (talk | contribs)
New page: <onlyinclude><includeonly>{{#ifeq:{{#replace:{{#urlencode:{{{1|}}}}}|%27|+}}|{{#replace:{{#urlencode:{{{2|}}}}}|%26%2339%3B|+}}|1|0}}</includeonly></onlyinclude>This template compares to s...
 
Zai Lynch (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<onlyinclude><includeonly>{{#ifeq:{{#replace:{{#urlencode:{{{1|}}}}}|%27|+}}|{{#replace:{{#urlencode:{{{2|}}}}}|%26%2339%3B|+}}|1|0}}</includeonly></onlyinclude>This template compares to strings, returns 1 when they are equal or 0 when they aren't. It is supposed to be used to comapare a string with a pagename, since they got different ways to encode apostrophs. Same for titlepart vs. <nowiki>{{PAGENAME}}</nowiki> magic words.
<onlyinclude><includeonly>{{#ifeq:{{#titleparts:{{{1|}}}}}|{{#titleparts:{{{2|}}}}}|1|}}</includeonly></onlyinclude>This template compares two strings, returns 1 when they are equal and an empty string otherwise. It is supposed to be used to comapare a string with a pagename, since they got different ways to encode apostrophs. It can be passed in an #if parser function.


== Usage ==
== Usage ==
Line 9: Line 9:


<div style="font-size: 130%; ">  
<div style="font-size: 130%; ">  
  <nowiki>{{</nowiki>compare|STRING|<nowiki>{{PAGENAME}}</nowiki>}}
  <nowiki>{{#if:{{</nowiki>compare|STRING|<nowiki>{{PAGENAME}}</nowiki>}}|do something if strings equal|else}}
</div>
</div>
{{hint
|mode=note
|desc=The <nowiki>{{PAGENAME}}</nowiki> magic word is supposed to be passed as second attribut.
}}

Latest revision as of 20:50, 9 April 2009

This template compares two strings, returns 1 when they are equal and an empty string otherwise. It is supposed to be used to comapare a string with a pagename, since they got different ways to encode apostrophs. It can be passed in an #if parser function.

Usage

{{compare|STRING1|STRING2}}

Example:

{{#if:{{compare|STRING|{{PAGENAME}}}}|do something if strings equal|else}}