Note: This is a project under development. The articles on this wiki are just being initiated and broadly incomplete. You can Help creating new pages.

Difference between revisions of "Template:Random slideshow"

From Ayurwiki
Jump to: navigation, search
(Created page with "{{Documentation subpage}} {{Mobile view problem|explanation=On mobile devices a standard gallery is displayed instead of the slideshow. If the screen width is less than 720px,...")
 
(Replaced content with "<includeonly>{{main other||{{#invoke:Random slideshow|main}}}}</includeonly><noinclude> {{Documentation}} </noinclude>")
(Tag: Replaced)
 
Line 1: Line 1:
{{Documentation subpage}}
+
<includeonly>{{main other||{{#invoke:Random slideshow|main}}}}</includeonly><noinclude>
{{Mobile view problem|explanation=On mobile devices a standard gallery is displayed instead of the slideshow. If the screen width is less than 720px, only the first four images after randomisation are visible ([[:File:Israel_portal_mobile_375x800.png|example screenshot]]). For mobile devices with larger resolutions, all images are displayed ([[:File:Israel_portal_mobile_800x920.png|example screenshot]]). For some tables it displays all images stacked ([[:File:Mobile view problem climate change.png|example screenshot]])}}
+
{{Documentation}}
{{Lua|Module:Random slideshow}}
+
</noinclude>
This template creates a slideshow [[Help:Gallery tag|gallery]] with a randomised order – i.e. it changes when the page is purged. '''It is intended for use in portals''' and will not display in article space.
 
 
 
== Usage ==
 
As many images and captions as desired may be specified, in the following format:
 
<syntaxhighlight lang="wikitext">
 
{{Random slideshow
 
| First image  | first caption
 
| second image | second caption
 
| third image  | third caption
 
}}
 
</syntaxhighlight>
 
Credits (e.g. "Photograph: [[User:Example|Example]]") may be specified, using the following format
 
<syntaxhighlight lang="wikitext">
 
{{Random slideshow
 
| First image  | first caption | credit1=
 
| second image | second caption | credit2=
 
| third image  | third caption | credit3=
 
}}
 
</syntaxhighlight>
 
===Parameters===
 
;{{para|1}}, {{para|3}}, {{para|5}}, ... {{resize|(or equivalent positional parameters)}}
 
:File name. The "File:" prefix is optional.
 
;{{para|2}}, {{para|4}}, {{para|6}}, ... {{resize|(or equivalent positional parameters)}}
 
:Caption for the file.
 
;{{para|credit1}}, {{para|credit2}}, {{para|credit3}}, ...
 
:Credits for the file. Optional.
 
;{{para|width}}
 
:Maximum width for all images; default is <code>100%</code> (intended for use inside portal components)
 
:Can be specified as a <code>%</code> (e.g. <kbd>75%</kbd>), or in <code>em</code>s (e.g. <kbd>30em</kbd>), or in <code>px</code> (e.g. <kbd>200px</kbd>)
 
:If a unit is not specified, <code>px</code> is assumed (i.e. <kbd>350</kbd> is equivalent to <kbd>350px</kbd>)
 
;{{para|random}}
 
:Set to <code>no</code> or <code>false</code> to turn off the randomisation.
 
 
 
==Examples==
 
{{Purge|Purge this page}} to see these galleries in a different order
 
===Cats===
 
<syntaxhighlight lang="wikitext">
 
{{Box-header|title=Selected pictures}}
 
{{Random slideshow  
 
| File:Cat playing with a lizard.jpg | Cat playing with a lizard
 
| Felis silvestris catus lying on rice straw.jpg | Cat lying on rice straw
 
| Mumbai 03-2016 63 Dhobi Talao Chowk.jpg | Cats in Mumbai
 
| File:Felis catus-cat on snow.jpg | Cat on snow
 
| Tired 20-year-old cat.jpg | Tired cat
 
}}
 
{{Box-footer}}
 
</syntaxhighlight>
 
<div style=max-width:600px>
 
{{Box-header|title=Selected pictures|EDIT=yes}}
 
{{Random slideshow
 
| File:Cat playing with a lizard.jpg | Cat playing with a lizard
 
| Felis silvestris catus lying on rice straw.jpg | Cat lying on rice straw
 
| Mumbai 03-2016 63 Dhobi Talao Chowk.jpg | Cats in Mumbai
 
| File:Felis catus-cat on snow.jpg | Cat on snow
 
| Tired 20-year-old cat.jpg | Tired cat
 
}}
 
{{Box-footer}}
 
</div>
 
===Mice===
 
<syntaxhighlight lang="wikitext">
 
{{Random slideshow | width=275
 
| File:Agouti Mice.jpg | Two mice | credit1= Photograph: Pogrebnoj-Alexandroff
 
| Brown mouse.jpg | Brown mouse | credit2= Photograph: [[User:Kulmalukko|Tiia Monto]]
 
| File:Farbmaeuse.jpg | Mice with food | credit3= Photograph: [[c:User:Whitesky~commonswiki|Whitesky]]
 
| File:Farbmaus.JPG | Mouse on a wheel | credit2= Photograph: [[de:User:R2Dine|R2Dine]]
 
| White lab mouse in hand B.jpg | A mouse in the hand is worth two in the bush | credit4= Photograph: Pogrebnoj-Alexandroff
 
}}
 
</syntaxhighlight>
 
{{Random slideshow | width=275
 
| File:Agouti Mice.jpg | Two mice | credit1= Photograph: Pogrebnoj-Alexandroff
 
| Brown mouse.jpg | Brown mouse | credit2= Photograph: [[User:Kulmalukko|Tiia Monto]]
 
| File:Farbmaeuse.jpg | Mice with food | credit3= Photograph: [[commons:User:Whitesky~commonswiki|Whitesky]]
 
| File:Farbmaus.JPG | Mouse on a wheel | credit4= Photograph: [[w:de:User:R2Dine|R2Dine]]
 
| White lab mouse in hand B.jpg | A mouse in the hand is worth two in the bush | credit5= Photograph: Pogrebnoj-Alexandroff
 
}}
 
 
 
== TemplateData ==
 
{{TemplateData header}}
 
<templatedata>
 
{
 
"params": {
 
"1": {
 
"aliases": [
 
"(unnamed positional parameter)"
 
],
 
"label": "Image 1",
 
"description": "Name of the first image, without prefix",
 
"example": "Portal puzzle.svg, 1=Portal puzzle.svg",
 
"type": "wiki-file-name",
 
"default": "(empty)",
 
"required": true
 
},
 
"2": {
 
"aliases": [
 
"(unnamed positional parameter)"
 
],
 
"label": "Caption 1",
 
"description": "Caption of the first image",
 
"example": "2=This is the default portal icon",
 
"type": "string",
 
"default": "(empty)",
 
"required": true
 
},
 
"3": {
 
"aliases": [
 
"(unnamed positional parameter"
 
],
 
"label": "Image 2",
 
"description": "Name of the second image, without prefix",
 
"example": "Brown mouse.jpg, 3=Brown mouse.jpg",
 
"type": "wiki-file-name",
 
"default": "(empty)",
 
"suggested": true
 
},
 
"4": {
 
"aliases": [
 
"(unnamed positional parameter)"
 
],
 
"label": "Caption 2",
 
"description": "Caption of the second image",
 
"example": "4=This is a brown mouse",
 
"type": "string",
 
"default": "(empty)",
 
"suggested": true
 
},
 
"width": {
 
"label": "Width",
 
"description": "Maximum width of all images",
 
"example": "width=80px, width=30em, width=50%",
 
"type": "number",
 
"default": "(none)",
 
"suggested": true
 
},
 
"credit1": {
 
"label": "Credit 1",
 
"description": "Credit for the first image",
 
"example": "Photograph: [[User:Example|Example]]"
 
},
 
"credit2": {
 
"label": "Credit 2",
 
"description": "Credits for the second image",
 
"example": "Photographer: [[User:Example|Example]]"
 
}
 
},
 
"description": "Creates a slideshow gallery with randomized order. Add as many images as desired.",
 
"paramOrder": [
 
"1",
 
"2",
 
"credit1",
 
"width",
 
"3",
 
"4",
 
"credit2"
 
],
 
"format": "block"
 
}
 
</templatedata>
 
 
 
{{Portal templates navbox}}
 
 
 
<includeonly>{{sandbox other||
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
 
 
}}</includeonly>
 

Latest revision as of 10:40, 10 September 2023

Template documentation[create]