Difference between revisions of "Template:HasProp/doc"

From Salem Wiki
Jump to: navigation, search
(Initial setup)
 
m (Protected "Template:HasProp/doc": Documentation of key-feature ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
==Syntax==
 
==Syntax==
 
:Type the below code somewhere inside your code: <code><nowiki>{{HasProp|propname|page=pagename}}</nowiki></code>
 
:Type the below code somewhere inside your code: <code><nowiki>{{HasProp|propname|page=pagename}}</nowiki></code>
:*'''''propname''''' <u>must</u> be provided, as an un-named parameter!
+
:*'''''propname''''' <u>must</u> be provided, as an un-named parameter! (else it will always output 'yes' as you can see..)
 
:*'''''page''''' is an optional parameter and defaults to <code><nowiki>{{FULLPAGENAME}}</nowiki></code>, this is to aid in debugging pages and examples....
 
:*'''''page''''' is an optional parameter and defaults to <code><nowiki>{{FULLPAGENAME}}</nowiki></code>, this is to aid in debugging pages and examples....
 +
 
==Examples==
 
==Examples==
#
+
#{{t|HasProp|page<nowiki>=</nowiki>GameMenu|IsGameMenu}} &rArr; &acute;{{HasProp|page=GameMenu|IsGameMenu}}&acute;
 +
#{{t|HasProp|page<nowiki>=</nowiki>GameMenu|IsGameMenus}} &rArr; &acute;{{HasProp|page=GameMenu|IsGameMenus}}&acute;
 
<includeonly>[[Category:Templates|{{PAGENAME}}]]<!-- Any categories for the template itself -->
 
<includeonly>[[Category:Templates|{{PAGENAME}}]]<!-- Any categories for the template itself -->
 
[[Category:Templates/©TriMoon™|{{SUBPAGENAME}}]]
 
[[Category:Templates/©TriMoon™|{{SUBPAGENAME}}]]
 
</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
 
</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>

Latest revision as of 18:19, 25 July 2012

Description

This helper-template is used to determine if a page has any value for a certain property.
It won't output anything at all when it can't find the property for the page, and simply output a 'yes' when it can.
This behavior is essential for use in {{#if:}} constructs.

Syntax

Type the below code somewhere inside your code: {{HasProp|propname|page=pagename}}
  • propname must be provided, as an un-named parameter! (else it will always output 'yes' as you can see..)
  • page is an optional parameter and defaults to {{FULLPAGENAME}}, this is to aid in debugging pages and examples....

Examples

  1. {{HasProp|page=GameMenu|IsGameMenu}} ⇒ ´yes´
  2. {{HasProp|page=GameMenu|IsGameMenus}} ⇒ ´´