Difference between revisions of "Template:Foreach"
Jump to navigation
Jump to search
(Replaced content with "<includeonly>{{#invoke:Foreach|w}}</includeonly><noinclude> {{Doc}} {{PAGENAME}} </noinclude>") |
(Undo revision 32740 by Andrewvaughan (talk)) |
||
Line 1: | Line 1: | ||
− | <includeonly>{{# | + | <includeonly><!-- |
− | {{ | + | -->{{#if:{{{2|}}}|<!-- -->{{<!-- -->{{{1}}}|{{{2}}}<!-- -->}}<!-- -->}}<!-- |
− | + | -->{{#if:{{{3|}}}|<!-- -->{{{delim|}}}{{<!-- -->{{{1}}}|{{{3}}}<!-- -->}}<!-- -->}}<!-- | |
+ | -->{{#if:{{{4|}}}|<!-- -->{{{delim|}}}{{<!-- -->{{{1}}}|{{{4}}}<!-- -->}}<!-- -->}}<!-- | ||
+ | -->{{#if:{{{5|}}}|<!-- -->{{{delim|}}}{{<!-- -->{{{1}}}|{{{5}}}<!-- -->}}<!-- -->}}<!-- | ||
+ | -->{{#if:{{{6|}}}|<!-- -->{{{delim|}}}{{<!-- -->{{{1}}}|{{{6}}}<!-- -->}}<!-- -->}}<!-- | ||
+ | -->{{#if:{{{7|}}}|<!-- -->{{{delim|}}}{{<!-- -->{{{1}}}|{{{7}}}<!-- -->}}<!-- -->}}<!-- | ||
+ | -->{{#if:{{{8|}}}|{{{delim|}}}{{{{{1}}}|{{{8}}}}}}}<!-- -->{{#if:{{{9|}}}|{{{delim|}}}{{{{{1}}}|{{{9}}}}}}}<!-- | ||
+ | -->{{#if:{{{10|}}}|{{{delim|}}}{{{{{1}}}|{{{10}}}}}}}<!-- -->{{#if:{{{11|}}}|{{{delim|}}}{{{{{1}}}|{{{11}}}}}}}<!-- | ||
+ | -->{{#if:{{{12|}}}|{{{delim|}}}{{{{{1}}}|{{{12}}}}}}}<!-- -->{{#if:{{{13|}}}|{{{delim|}}}{{{{{1}}}|{{{13}}}}}}}<!-- | ||
+ | -->{{#if:{{{14|}}}|{{{delim|}}}{{{{{1}}}|{{{14}}}}}}}<!-- -->{{#if:{{{15|}}}|{{{delim|}}}{{{{{1}}}|{{{15}}}}}}}<!-- | ||
+ | -->{{#if:{{{16|}}}|{{{delim|}}}{{{{{1}}}|{{{16}}}}}}}<!-- -->{{#if:{{{17|}}}|{{{delim|}}}{{{{{1}}}|{{{17}}}}}}}<!-- | ||
+ | -->{{#if:{{{18|}}}|{{{delim|}}}{{{{{1}}}|{{{18}}}}}}}<!-- -->{{#if:{{{19|}}}|{{{delim|}}}{{{{{1}}}|{{{19}}}}}}}<!-- | ||
+ | -->{{#if:{{{20|}}}|{{{delim|}}}{{{{{1}}}|{{{20}}}}}}}<!-- -->{{#if:{{{21|}}}|{{{delim|}}}{{{{{1}}}|{{{21}}}}}}}<!-- | ||
+ | -->{{#if:{{{22|}}}|{{{delim|}}}{{{{{1}}}|{{{22}}}}}}}<!-- -->{{#if:{{{23|}}}|{{{delim|}}}{{{{{1}}}|{{{23}}}}}}}<!-- | ||
+ | -->{{#if:{{{24|}}}|{{{delim|}}}{{{{{1}}}|{{{24}}}}}}}<!-- -->{{#if:{{{25|}}}|{{{delim|}}}{{{{{1}}}|{{{25}}}}}}}<!-- | ||
+ | -->{{#if:{{{26|}}}|{{{delim|}}}{{{{{1}}}|{{{26}}}}}}}<!-- -->{{#if:{{{27|}}}|{{{delim|}}}{{{{{1}}}|{{{27}}}}}}}<!-- | ||
+ | -->{{#if:{{{28|}}}|{{{delim|}}}{{{{{1}}}|{{{28}}}}}}}<!-- -->{{#if:{{{29|}}}|{{{delim|}}}{{{{{1}}}|{{{29}}}}}}}<!-- | ||
+ | -->{{#if:{{{30|}}}|{{{delim|}}}{{{{{1}}}|{{{30}}}}}}}<!-- -->{{#if:{{{31|}}}|{{{delim|}}}{{{{{1}}}|{{{31}}}}}}}<!-- | ||
+ | -->{{#if:{{{32|}}}|{{{delim|}}}{{{{{1}}}|{{{32}}}}}}}<!-- -->{{#if:{{{33|}}}|{{{delim|}}}{{{{{1}}}|{{{33}}}}}}}<!-- | ||
+ | -->{{#if:{{{34|}}}|{{{delim|}}}{{{{{1}}}|{{{34}}}}}}}<!-- -->{{#if:{{{35|}}}|{{{delim|}}}{{{{{1}}}|{{{35}}}}}}}<!-- | ||
+ | -->{{#if:{{{36|}}}|{{{delim|}}}{{{{{1}}}|{{{36}}}}}}}<!-- -->{{#if:{{{37|}}}|{{{delim|}}}{{{{{1}}}|{{{37}}}}}}}<!-- | ||
+ | -->{{#if:{{{38|}}}|{{{delim|}}}{{{{{1}}}|{{{38}}}}}}}<!-- -->{{#if:{{{39|}}}|{{{delim|}}}{{{{{1}}}|{{{39}}}}}}}<!-- | ||
+ | -->{{#if:{{{40|}}}|{{{delim|}}}{{{{{1}}}|{{{40}}}}}}}<!-- -->{{#if:{{{41|}}}|{{{delim|}}}{{{{{1}}}|{{{41}}}}}}}<!-- | ||
+ | -->{{#if:{{{42|}}}|{{{delim|}}}{{{{{1}}}|{{{42}}}}}}}<!-- -->{{#if:{{{43|}}}|{{{delim|}}}{{{{{1}}}|{{{43}}}}}}}<!-- | ||
+ | -->{{#if:{{{44|}}}|{{{delim|}}}{{{{{1}}}|{{{44}}}}}}}<!-- -->{{#if:{{{45|}}}|{{{delim|}}}{{{{{1}}}|{{{45}}}}}}}<!-- | ||
+ | -->{{#if:{{{46|}}}|{{{delim|}}}{{{{{1}}}|{{{46}}}}}}}<!-- -->{{#if:{{{47|}}}|{{{delim|}}}{{{{{1}}}|{{{47}}}}}}}<!-- | ||
+ | -->{{#if:{{{48|}}}|{{{delim|}}}{{{{{1}}}|{{{48}}}}}}}<!-- -->{{#if:{{{49|}}}|{{{delim|}}}{{{{{1}}}|{{{49}}}}}}}<!-- | ||
+ | -->{{#if:{{{50|}}}|{{{delim|}}}{{{{{1}}}|{{{50}}}}}}}<!-- -->{{#if:{{{51|}}}|{{{delim|}}}{{{{{1}}}|{{{51}}}}}}}<!-- | ||
+ | --></includeonly> | ||
+ | <noinclude> | ||
+ | {{documentation}} | ||
</noinclude> | </noinclude> |
Latest revision as of 23:52, 27 April 2017
Purpose
To repeatedly use a template for each argument in a pipe delimited list. The template handles up to 30 list items.
Example
- Create comma delimited links to each hook in a list
{{foreach|Link|delim=, |Item A|Item B}}
→ Item A, Item B
Usage
{{Foreach[|delim=delim]|templatename|item1[|item2]...}}
- templatename - the name of a template that takes at least one parameter. Only the first parameter will be used, so the remaining parameters must be optional.
- item1 - the first item to pass to the template, resulting in {{templatename|item1}}
- item2,... - (optional) the second and following items to pass to the template, resulting in {{templatename|item2}}, etc.
- delim - (optional) a delimiter that should be inserted between the list items after the template templatename has been applied to each
The above documentation is transcluded from Template:Foreach/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |