Difference between revisions of "User talk:Merchant"

From comp.tf
Jump to navigation Jump to search
m
Line 9: Line 9:
  
 
Nope, good for now. Thanks. [[User:Merchant|Merchant]] ([[User talk:Merchant|talk]])
 
Nope, good for now. Thanks. [[User:Merchant|Merchant]] ([[User talk:Merchant|talk]])
 +
 +
== Re: Creating Infoboxes. ==
 +
 +
I have fixed the template for you. Here's what I did:
 +
* The <code><nowiki>{{#if:}}</nowiki></code> statement enables you to execute different command in cases when the field is empty, and when it is not. The syntax is as follows: <code><nowiki>{{#if:{{{templatefieldname|}}}</nowiki>|''conditions_when_nonempty''|''conditions_when_empty''}}</code>.
 +
: Your code was missing the closing curly braces. That has been now fixed.
 +
: Another note on the template; as you know, defining table cells requires the usage of the pipe symbol (<code>|</code>). When using the if statement however, every pipe symbol is treated as it was part of the statement itself, therefore leading to funky results. If you want the if command to contain cells or pipe symbols in some other context, use the [[Template:!|pipe escape template]] (<code><nowiki>{{!}}</nowiki></code>). It essentially replaces the pipe symbol without breaking the if statement.
 +
* A word on template names and user spaces. As you noticed, every template page has a prefix, which is commonly referred to as a ''namespace''. An example of such a name is e.g. [[Template:6s team roster]]. But when actually invoking said template in a page, the template namespace is omitted (<code><nowiki>{{6s team roster}}</nowiki></code>).
 +
: The template you created however is not in the template namespace; it actually is in your user namespace. To make it work, you have to use the full page name, which is, in your case, <code><nowiki>{{User:Merchant/Template:Classes}}</nowiki></code>.
 +
: Also, another useful thing to keep in mind, if you simply include a template in a template normally, a template loop is created. This is obviously undesirable. The solution is to use the <code><nowiki>&lt;noinclude&gt;</nowiki></code> tags. Everything between these tags will be contained on the template page, but will not appear when the template is used on another page.
 +
Sorry for this drawn-out and maybe perhaps obtuse explanation, but I tried to explain the intricacies of MediaWiki templates to give you an idea how it all works. Anyway, get back to me if you need anything else. —[[User:Atlas|Atlas]] ([[User talk:Atlas|talk]]) 13:09, 9 August 2013 (WEST)

Revision as of 12:09, 9 August 2013

Re:Using the eseacomment templete thing to add UGC HL alternative maps.

All fixed now. If you need anything else, just let me know. --Atlas (talk) 18:01, 29 July 2013 (WEST)

Re: One more question about map infoboxes and content menus.

  • The map infobox was slightly bugged. I've fixed it now, it will always stick to the top of the page regardless of positioning.
  • The content menu is added automatically by MediaWiki once the page has enough sections or sub-sections. If you keep expanding the page, adding new sections, the content menu should appear.

If you need anything else, just let me know. —Atlas (talk) 10:41, 30 July 2013 (WEST)

Nope, good for now. Thanks. Merchant (talk)

Re: Creating Infoboxes.

I have fixed the template for you. Here's what I did:

  • The {{#if:}} statement enables you to execute different command in cases when the field is empty, and when it is not. The syntax is as follows: {{#if:{{{templatefieldname|}}}|conditions_when_nonempty|conditions_when_empty}}.
Your code was missing the closing curly braces. That has been now fixed.
Another note on the template; as you know, defining table cells requires the usage of the pipe symbol (|). When using the if statement however, every pipe symbol is treated as it was part of the statement itself, therefore leading to funky results. If you want the if command to contain cells or pipe symbols in some other context, use the pipe escape template ({{!}}). It essentially replaces the pipe symbol without breaking the if statement.
  • A word on template names and user spaces. As you noticed, every template page has a prefix, which is commonly referred to as a namespace. An example of such a name is e.g. Template:6s team roster. But when actually invoking said template in a page, the template namespace is omitted ({{6s team roster}}).
The template you created however is not in the template namespace; it actually is in your user namespace. To make it work, you have to use the full page name, which is, in your case, {{User:Merchant/Template:Classes}}.
Also, another useful thing to keep in mind, if you simply include a template in a template normally, a template loop is created. This is obviously undesirable. The solution is to use the <noinclude> tags. Everything between these tags will be contained on the template page, but will not appear when the template is used on another page.

Sorry for this drawn-out and maybe perhaps obtuse explanation, but I tried to explain the intricacies of MediaWiki templates to give you an idea how it all works. Anyway, get back to me if you need anything else. —Atlas (talk) 13:09, 9 August 2013 (WEST)