Wikipedia:Don't use hiddenStructure: Difference between revisions

Content deleted Content added
m Diffs: add a section for diffs
Omniplex (talk | contribs)
merged into WP:HIDE
 
(31 intermediate revisions by 7 users not shown)
Line 1:
*#REDIRECT [[Wikipedia:HiddenStructure]] {{R from merge}}
Recently a [[cascading style sheets]] (CSS) "hack" known more generally as "[[Wikipedia:HiddenStructure|''hiddenStructure'']]" has seen widespread use on Wikipedia. This hack makes it possible to conditionally hide rows of data in tables dependent upon whether or not certain parameters are passed (or are/aren't empty/blank).
 
==Problems==
{| style="float: right; border: none; background: transparent; margin-left: 1em; padding: 0;"
|-
| [[Image:Lynx.uss monitor.css.png|thumb|150px|[[USS Monitor]] using CSS hacks]]
| [[Image:Lynx.uss monitor.meta.png|thumb|150px|[[USS Monitor]] using meta-templates]]
|}
The problem with using ''hiddenStructure'' is that it hides rows in a non-standard way. Whereas other websites hide data by simply not sending it out from the server<ref>Most servers use PHP or ASP to conditionally send data from the server. More advanced designs cache results so PHP/ASP scripts are only executed once for each possible outcome.</ref>, ''hiddenStructure'' defers this hiding process to the client. Because of this, some non-CSS aware or compliant browsers incorrectly render pages using this hack (see pictures at right).
 
<br clear="both" />
{| style="float: right; border: none; background: transparent; margin-left: 1em; padding: 0;"
|-
| [[Image:Lynx.blue whale.css.png|thumb|150px|[[Blue Whale]] using CSS hacks]]
| [[Image:Lynx.blue whale.meta.png|thumb|150px|[[Blue Whale]] using meta-templates]]
|}
Some pages minimize the damage by only displaying the variable if it's actually non-blank (using the syntax <code><nowiki>{{{variable|}}}</nowiki></code>). In this way only the row is displayed, not the ugly <nowiki>{{{variable}}}</nowiki> variable name. Of course in templates with large numbers of conditional rows, this still results in unnecessary data being displayed to non-CSS compliant browsers.
 
Because of these problems many articles render poorly for the disabled. In the worst case, a number of Wiki-markup variables are displayed/read to the reader. In the best case, a number of rows are displayed/read which are empty. For these reasons, ''hiddenStructure'' should not be used.
 
==Solutions==
Solutions, in order of preference, are.
 
* Use Weeble code (such as {{tl|row}}).
**'''Advantage''': When conditional syntax is brought into MediaWiki, using [[Special:Whatlinkshere]] should make it easy to identify templates which need to be upgraded.
* Use meta-templates such as {{tl|qif}} to conditionally display data.
**'''Advantage''': When conditional syntax is brought into MediaWiki, using [[Special:Whatlinkshere]] should make it easy to identify templates which need to be upgraded.
* Limit or eliminate conditional rows.
 
Other possible solutions, which are ill-advised, include:
* Breaking apart a single template into various multiple other templates, with each handling different combinations of parameters.
**'''Problem''': This is a maintenance nightmare, and goes against the purpose of templates (centralizing maintenance to one place).
 
==Notes==
<references />
 
==Diffs==
* [http://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Avoid_using_meta-templates&diff=36124214] — Here Brion VIBBER, lead developer of MediaWiki, describes some of the problems with hiddenStructure.
 
==See also==
* [[Wikipedia:HiddenStructure]]
* [[Wikipedia:Avoid using meta-templates]] (deprecated/rejected)