Template:Auto List to Icons: Difference between revisions
Jump to navigation
Jump to search
setting up for regular use |
m revert Tag: Manual revert |
||
| (14 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<noinclude> | <noinclude>This template converts keywords into icons, if found. | ||
Read below the legend for typical template instructions. | |||
Icon Legend | |||
{{#ask:[[Category:Infobox Icons]][[ | {{List to Icons Table|#userparam=intro}} | ||
|? | {{List to Icons Table|#userparam=header|header=<div id="activities">Nature Activities (hiking, biking, etc.) (Infobox Icon Type: Activities)</div>}} | ||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Activities]] | |||
|mainlabel=image | |||
|?Has Caption=description | |||
|?Semantic Keyword=keyword | |||
|format=plainlist | |||
|headers=hide | |headers=hide | ||
|link=none | |link=none | ||
| | |template=List to Icons Table | ||
|userparam=row | |||
|named args=yes | |||
}} | }} | ||
{{List to Icons Table|#userparam=header|header=<div id="features">Features within the park or along the trail (Infobox Icon Type: Features)</div>}} | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Features]] | |||
{{List to Icons Table|#userparam=header|header= | |||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type:: | |||
|mainlabel=image | |mainlabel=image | ||
|?Has Caption=description | |?Has Caption=description | ||
| Line 31: | Line 29: | ||
|named args=yes | |named args=yes | ||
}} | }} | ||
{{List to Icons Table|#userparam=header|header=Park Amenities (Infobox Icon Type: Park Amenities)}} | {{List to Icons Table|#userparam=header|header=<div id="amenities">Park Amenities (Infobox Icon Type: Park Amenities)</div>}} | ||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Park Amenities]] | {{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Park Amenities]] | ||
|mainlabel=image | |mainlabel=image | ||
| Line 43: | Line 41: | ||
|named args=yes | |named args=yes | ||
}} | }} | ||
{{List to Icons Table|#userparam=header|header=Lodging options within the park (Infobox Icon Type: Lodging)}} | {{List to Icons Table|#userparam=header|header=<div id="lodging">Lodging options within the park (Infobox Icon Type: Lodging)</div>}} | ||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Lodging]] | {{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Lodging]] | ||
|mainlabel=image | |mainlabel=image | ||
| Line 55: | Line 53: | ||
|named args=yes | |named args=yes | ||
}} | }} | ||
{{List to Icons Table|#userparam=header|header=Campground amenities (Infobox Icon Type: Campground Amenities)}} | {{List to Icons Table|#userparam=header|header=<div id="campground">Campground amenities (Infobox Icon Type: Campground Amenities)</div>}} | ||
{{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Campground Amenities]] | {{#ask:[[Category:Infobox Icons]][[Infobox Icon Type::Campground Amenities]] | ||
|mainlabel=image | |mainlabel=image | ||
| Line 69: | Line 67: | ||
{{List to Icons Table|#userparam=outro}} | {{List to Icons Table|#userparam=outro}} | ||
[[Category: | Simply pass the template the comma separated list of terms and it will convert any found keywords to icons, and list the remainder. Although the icons have different groupings, the template doesn't care and is simply looking for keywords with an associated icon. | ||
Expected usage: | |||
<pre> | |||
{{Template:Auto List to Icons|List=<insert comma separated list>}} | |||
</pre> | |||
How this works: | |||
* Create an array called 'iconslist' of the keywords found in a query of all pages under the category [[:Category:Infobox Icons]] | |||
* Make an array called 'list' from the passed parameter names list | |||
* Make an array called 'noiconsitems' which is the arraydiff of the first two created arrays (items on the passed list that don't have an icon) | |||
* Make a fourth array 'iconitems' which is the intersection of the first two arrays (items on the passed list that '''do''' have an icon) | |||
* For each iconitems, find the keyword matching image and show it | |||
* Then finally, list the noiconsitems last | |||
Edit the page to see the details. | |||
[[Category:Universal Templates]] | |||
</noinclude><includeonly>{{#ask:[[Category:Infobox Icons]] | </noinclude><includeonly>{{#ask:[[Category:Infobox Icons]] | ||
|mainlabel=- | |mainlabel=- | ||
| Line 92: | Line 107: | ||
| | | | ||
}}<!-- | }}<!-- | ||
-->{{#arrayprint:noiconitems}} | --><br>{{#arrayprint:noiconitems}} | ||
</includeonly> | </includeonly> | ||
Latest revision as of 14:44, 24 June 2023
This template converts keywords into icons, if found.
Read below the legend for typical template instructions.
Icon Legend
Simply pass the template the comma separated list of terms and it will convert any found keywords to icons, and list the remainder. Although the icons have different groupings, the template doesn't care and is simply looking for keywords with an associated icon.
Expected usage:
{{Template:Auto List to Icons|List=<insert comma separated list>}}
How this works:
- Create an array called 'iconslist' of the keywords found in a query of all pages under the category Category:Infobox Icons
- Make an array called 'list' from the passed parameter names list
- Make an array called 'noiconsitems' which is the arraydiff of the first two created arrays (items on the passed list that don't have an icon)
- Make a fourth array 'iconitems' which is the intersection of the first two arrays (items on the passed list that do have an icon)
- For each iconitems, find the keyword matching image and show it
- Then finally, list the noiconsitems last
Edit the page to see the details.











































