Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Table
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Conditional table row === {{main|Wikipedia:Conditional tables}} For a conditional row in a table, we can have: <div class="box"> '''Wikitext''' <syntaxhighlight lang="wikitext" style="display: inline-block;"> {| class=wikitable {{ #if:1|{{!}}- ! scope=row {{!}} row one, column one {{!}}row one, column two}} {{ #if: |{{!}}- ! scope=row {{!}} row two, column one {{!}}row two, column two}} |- ! scope=row {{!}} row three, column one | row three, column two |} </syntaxhighlight></div> <div class="box"> '''Produces''' {| class=wikitable <!-- Row one is shown because the '1' evaluates to TRUE --> {{ #if:1|{{!}}- ! scope=row {{!}} row one, column one <!-- {{!}}'s get evaluated to the pipe character '|', i.e. template:! just contains '|' --> {{!}}row one, column two}} <!-- Row two NOT shown because the space between the ':' and the '|' evaluates to FALSE --> {{ #if: |{{!}}- ! scope=row {{!}} row two, column one {{!}}row two, column two}} <!-- Row three is shown --> |- ! scope=row {{!}} row three, column one | row three, column two |} </div> With comments to explain how it works, where note how the second row is missing: <div class="box"> '''Wikitext''' <syntaxhighlight lang="wikitext" style="display: inline-block;"> {| class=wikitable <!-- Row one is shown because the '1' evaluates to TRUE. --> {{ #if:1|{{!}}- ! scope=row {{!}} row one, column one <!-- Any {{!}}'s are evaluated to the pipe character '|' since the template '!' just contains '|'. --> {{!}}row one, column two}} <!-- Row two is NOT shown because the space between the ':' and the '|' evaluates to FALSE. --> {{ #if: |{{!}}- ! scope=row {{!}} row two, column one {{!}}row two, column two}} <!-- Row three is shown. --> |- ! scope=row {{!}} row three, column one | row three, column two |} </syntaxhighlight></div> <div class="box"> '''Produces''' {| class=wikitable <!-- Row one is shown because the '1' evaluates to TRUE --> {{ #if:1|{{!}}- ! scope=row {{!}} row one, column one <!-- {{!}}'s get evaluated to the pipe character '|', i.e. template:! just contains '|' --> {{!}}row one, column two}} <!-- Row two NOT shown because the space between the ':' and the '|' evaluates to FALSE --> {{ #if: |{{!}}- ! scope=row {{!}} row two, column one {{!}}row two, column two}} <!-- Row three is shown --> |- ! scope=row {{!}} row three, column one | row three, column two |} </div>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)