Template talk:Hide
From Wikipedia, the free encyclopedia
This template was created for the purpose of allowing for disabling of parameters in templates that are not used by all pages using the template.
Usage: subst must be used when implementing this template, or it will not function correctly!
i.e. {{subst:hide|Parameter}} or {{subst:unhide|Parameter}} Where Parameter is the name of the Parameter that acts for enabling text hide option.
{{subst:Hide|True}}
This text is not shown.
{{subst:Unhide|True}}
Advantages:
- Allows for parameters to be omitted from templates.
- Reduces editing of multiple pages that use templates that have changed.
- only uses one-level of meta-templating and only on pages that use the extra parameter (good if extra parameter is used only on a few pages). Meta-Templates are non existant for pages that don't use the extra parameters, and hence do not cause server slowdowns.
- can easily be replaced when wiki-code supports more options under templates (this is due to the modifications mainly being in main template as opposed to code being in each article that the template used in)
Disadvantages:
- Generates weird looking HTML in wiki source (large div tags that makes template source harder to edit).
- uses meta-templating when Parameter is "True" (bad if extra parameters are used on popular)
- if extra parameter is not used, Hide and Unhide causes template missing information to be created (information is covered up using div tags).
Contents |
[edit] Principle
Uses <div> tags to alternate supression of HTML by changing the order of "open" and "close" div tags (<div ...> and </div>) using templates (in effect turning "on" and "off" specified regions of HTML).
When the Hide/Unhide templates are used in conjunction, HTML is generated properly whether the parameter (that is being used to determine the hide) exists or not. But the wiki-formating doesn't like templates that don't exist and so the resulting {{name of the Template that doesn't exist}} has to be hidden using div tags.
Example of supressed text:
<div style="visibility:hidden; position:absolute;">
Text doesn't Show
</div>
Result:
Example of supressed text:
To re-enable a close </div> tag is inserted as a block.
Example of re-enabled text: <div style="visibility:hidden; position:absolute;"> </div> Text does Show <div><!--dummy div--></div>
Result:
Example of re-enabled text: Text does Show
[edit] Talk
[edit] TFD Template:Hide
- This template was listed on templates for deletion, but there was no consensus to delete. See the log. (archive entry) Courtland 02:22, 1 September 2005 (UTC)
[edit] New format
Template:hide and Template:unhide contain the following wikicode (respectively)
<div style="visibility:hidden; position:absolute;">{{Hide = {{{{{{1}}}}}}}}</div>
<div style="visibility:hidden; position:absolute;">{{Unhide = {{{{{{1}}}}}}}}</div>
and the contents of Template:Hide = True is:
</div><div style="visibility:hidden; position:absolute;"> <div style="visibility:hidden; position:absolute;">
and Template:Unhide = True contains:
</div>
--BCKILLa 03:02, 5 October 2005 (UTC)]]
[edit] Case sensitivity
Templates Template:Hide = true, Template:Hide = hide, and Template:Hide = Hide redirect to Template:Unhide = hide and Template:Unhide = true, Template:Unhide = hide, and Template:Unhide = Hide redirect to Template:Unhide = True. --BCKILLa 10:56, 10 October 2005 (UTC)