Using templates to display a table of images

From semantic-mediawiki.org
< Demo:Examples‎ | Queries
ExamplesExamples/QueriesUsing templates to display a table of images
Templates for displaying images
This page shows an example for the template format used to display a table of images.
Format
Keywords
Table of Contents

Simple example[edit]

Query not using a template[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Has image::+]]
 |?Has image=image
 |offset=0
 |limit=5
}}
Result
 image
AmsterdamAmsterdam - Waag.jpg
Frankfurt40564870 7c39a94ac4 z.jpg
KarlsruheKarlsruher Pyramide.JPG
London2166320938 5cfc9ec72a z.jpg
Munich3363305632 c136da22e7 z.jpg
... further results

Advanced examples[edit]

Query using three templates[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Has image::+]]
 |?Has image
 |format=plainlist
 |headers=show
 |link=none
 |template=Demo/Template/City/Image
 |introtemplate=Demo/Template/City/Image/Intro
 |outrotemplate=Demo/Template/City/Image/Outro
 |offset=0
 |limit=20
}}
Result

The above query will yield a table output containing images of selected cities.

... further results

Templates used

Query using one template in three modes[edit]

Syntax
{{Demo/Template/City/ImageShow|userparam=intro}}
{{#ask:
 [[Category:City]]
 [[Has image::+]]
 |?Has image=image
 |format=plainlist
 |headers=show
 |link=none
 |template=Demo/Template/City/ImageShow
 |userparam=row
 |named args=yes
 |offset=0
 |limit=5
}}
{{Demo/Template/City/ImageShow|userparam=outro}}
Result
... further results
City Image
Template used