แม่แบบ:Ifnoteq then show
หน้าตา
This template tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter.
This is useful when the first parameter is a {{#invoke: }} of a Lua module that returns a value for which a specific exception is required. Because it uses the {{#invoke: }} just once, it simplifies the coding of infoboxes, for example.
Usage[แก้]
An infobox field may return the ประเทศ (P17) for an article about a city. We may wish to use the abbreviation "USA" in place of "United States".
- ประเทศ (P17) for ยอร์ก (Q42462)
{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}
→ สหราชอาณาจักร{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}|[[United States|United States]]|USA}}
→ สหราชอาณาจักร
- ประเทศ (P17) for นครนิวยอร์ก (Q60)
{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}
→ สหรัฐ{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}|[[United States|United States]]|USA}}
→ สหรัฐ
คู่มือการใช้งานที่ปรากฏด้านบนนี้ดึงมาจาก แม่แบบ:Ifnoteq then show/doc (แก้ | ประวัติ) ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของแม่แบบนี้ โปรดเพิ่มหมวดหมู่ไปที่หน้าย่อย /doc หน้าย่อยของแม่แบบนี้ |