Help:Embeddable templates

From CruisersWiki

(Difference between revisions)
Jump to: navigation, search
(Infobox marina)
(Infobox country)
Line 148: Line 148:
===[[Template:Infobox country|Infobox country]]===
===[[Template:Infobox country|Infobox country]]===
-
{{infobox country
+
{{doc|Template:Infobox country}}
-
| map=Italymap.gif
+
-
| mapwidth=330px
+
-
| flag=Italyflag.gif
+
-
| capital=Rome
+
-
| capitalcoord={{Coord|41|54.00|N|012|29.00|E}}
+
-
| language=Italian
+
-
| currency=Euro €
+
-
| timezone=CET (UTC + 1)
+
-
| dsttimezone=CEST (UTC + 2 summer)
+
-
| notes=
+
-
| news=
+
-
}}
+
-
 
+
-
This template is somewhat similar to the previous one, but it was designed to create an infobox that is specific to an article about a [[Template:Country|country]] or an [[Template:Island Country|island country]]:
+
-
<pre><nowiki>{{infobox country
+
-
| map=
+
-
| mapwidth=
+
-
| flag=
+
-
| capital=
+
-
| capitalcoord={{Coord|||N|||E}}
+
-
| language=
+
-
| currency=
+
-
| timezone=
+
-
| dsttimezone=
+
-
| notes=
+
-
| news=
+
-
}}</nowiki></pre>
+
-
Example:
+
-
<pre><nowiki>{{infobox country
+
-
| map=Italymap.gif
+
-
| mapwidth=330px
+
-
| flag=Italyflag.gif
+
-
| capital=Rome
+
-
| capitalcoord={{Coord|41|54.00|N|012|29.00|E}}
+
-
| language=Italian
+
-
| currency=Euro €
+
-
| timezone=CET (UTC + 1)
+
-
| dsttimezone=CEST (UTC + 2 summer)
+
-
| notes=
+
-
| news=
+
-
}}</nowiki></pre>
+
-
 
+
-
This expands to a table shown at the beginning of this section. As with the previous example the title of table is automatically created from this page title hence it renders here to something that is not quite useful.
+
===[[Template:Infobox marina|Infobox marina]]===
===[[Template:Infobox marina|Infobox marina]]===

Revision as of 19:00, 10 March 2015

This is a draft. Don't use it in production!

An introduction into embeddable templates

There are 2 kind of templates in this wiki and one should not be mistaken for another:

  • An article template (or Page template) is essentially an article's stub or a boilerplate. To create a new article a user simply copies it's wiki text and pastes it into a new empty article page.
  • An embeddable template (or a MediaWiki template) on the other hand is generally used to bring a smaller sniplet of mediawiki markup into an article page. They could be seen as a sort of shortcuts introduced into a wiki to implement some common pattern to avoid excessive typing and errors and to implement some common style.

In this sense an embeddable template can be seen as a stencil for some article's feature while an article template is more like a foundation for a whole article.

Similar to an article template a source text for an embeddable template is stored in a wiki page prefixed with "Template:". The difference with a normal wiki page (or an article template) and MediaWiki template is that the later kind of a template is designed to be embedded (or transcluded) into another page.

Using templates

In the text below embeddable templates will be called simply templates.

Suppose you have a Template:Hello

Hello world!

Then this text can be embedded into another page with this construct:

{{hello}}

An expanded text of a template could be modified with template parameters. Imagine some other template could be called:

{{morning|Earth}}

And give:

Good morning Earth!

Or even like this:

{{go | destination=the Universe}}

Could give:

Our destination is the Universe

Position marking templates

Coord

This template is used to represent coordinates of some geographic location like this:

{{Coord|DD|M.M|N/S|DD|M.M|E/W|}}

It can be used in combination with Poi or Infobox templates (see below) or standalone, as described in Pagetemplates#CO-ORDINATES TEMPLATE,

The first 3 parameters of a template are: round number degrees of latitude, minutes of latitude, N or S for hemisphere. The last 3 parameters are the similar to the first group, but they rather denote the longitude part of a coordinate.

Example:
{{Coord|37|43.6|N|26|50.6|W|}}

will show as: 37°43.6′N, 26°50.6′W.

POI

POI stands for point of interest. In a wiki article it denotes some geographic location like a city, port or an anchorage. Such a POI must have a name and a type, also it should have some geographic coordinates and a description text.

Example:

{{poi
|type=anchorage
|name=Cala Spinosa
|coord={{Coord|41|14.633|N|9|08.904|E}}
|text=A narrow bay W of Baia di Santa Reparata, good holding on sandy patches.
}}

This expands to:

Cala Spinosa

Cala Spinosa/wiki/Help:Embeddable_templates#Cala_Spinosa
Anchorage icon Cala Spinosa [[Help:Embeddable templates#Cala Spinosa|Cala Spinosa]]
A narrow bay W of Baia di Santa Reparata, good holding on sandy patches.

To include it into an article copy & paste:

{{poi
|type=
|name=
|coord={{Coord|||N|||E}}
|text=
}}

A value of a type parameter should be one of: port, berth, marina, anchorage, shopping, other ( anything else?).

POI inline

This template is quite similar to POI template, except it doesn't break a paragraph and does not create headings, thus it could be used inside a paragraph ("inline").

To include it into a page copy & paste:

{{poi inline
|type=
|name=
|pretext=
|coord={{Coord|||N|||E}}
|text=
}}

Example:

* A few small shops in the town. 
* "ISA" is the nearest minimarket from the harbour. {{poi inline
|type=shopping
|name="ISA" grocery store
|pretext=It is located (
|coord={{coord|41|14.356|N|9|11.446|E|}}
|text=) at the first crossing from the harbour on the Via del Porto}} (with Via Angioy and Via Petrini)
* 

Expands to:

  • A few small shops in the town.
  • "ISA" is the nearest minimarket from the harbour. Template:Poi inline (with Via Angioy and Via Petrini)

Article information templates

Infobox

This template was designed to be used to place a table with some standard data (an information box") at the beginning of an article. Such a table is described at the Pagetemplates article. This template allows creating such a table a more simple way:

{{infobox
| coord={{Coord|||N|||E}}
| panoramio=
| chartlet=
| image=
| imagetext=
}}

Example:

{{infobox
| coord={{Coord|41|14.74|N|09|11.93|E|}}
| panoramio=http://www.panoramio.com/map/#lt=41.241287&ln=9.197445&z=2&k=1&a=1&tab=1
| chartlet=http://mapserver.mytopo.com/homepage/index.cfm?lat=41.245667&lon=9.198833&scale=24000&zoom=50&type=1
| image=SantaTeresa.jpg
| imagetext=The port of Santa Teresa
}}

This expands to a table shown at the beginning of this section.

NB: The title of table is automatically created from this page title hence it reads here as "Embeddable templates".

Infobox country

Italy
41°54.00′N, 012°29.00′E Chart icon.png
EU-Italy.svg
Magnify-clip.png
Location of Italy (dark green) in Europe
Flag_of_Italy.svg
Magnify-clip.png
Flag
Capital Rome
Language Italian
Currency Euro €
Time zone CET (UTC+1) , DST: CEST (UTC+2)
Calling code +39
Embeddable templates
41°54.00′N, 012°29.00′E Chart icon.png
Italymap.gif
Magnify-clip.png
Map
Italyflag.gif
Magnify-clip.png
Flag
Capital Rome
Language Italian
Currency Euro €
Time zone CET (UTC+1) , DST: CEST (UTC+2)
Calling code +39
Some notes
Small info.png Latest News
Some news

This template was designed to create an infobox that is specific to an article about a country or an island country:

{{infobox country 
| lat=
| lon=
| zoom= 
| chartlet= 
| image=
| imagewidth=
| flag=
| capital= 
| language=
| currency=
| timezone=
| dsttimezone=
| code=
| notes=
| news=
}}

Example:

{{infobox country 
| lat=41 54.00 N
| lon=012 29.00 E
| inage= Italymap.gif
| inagewidth= 330px
| flag= Italyflag.gif
| capital= Rome 
| language= Italian
| currency= Euro €
| timezone= CET (UTC + 1)
| dsttimezone= CEST (UTC + 2 summer)
| code= +39
| notes= Some notes
| news= Some news
}}

This expands to a table shown at the beginning of this section. As with the previous example the title of table is automatically created from this page title hence it renders here to something that is not quite useful.

Infobox marina

41°14.159′N, 9°11.671′E Chart icon.png
SantaTeresa.jpg
Magnify-clip.png
The port of Santa Teresa
Radio VHF channel 12
Phone +39 (789) 751936
Fax +39 (789) 751936
E-mail [email protected]
Berths 400
Max. length 35
Max. draft ?
Fuel Fuel station
Water Yes, on berth
Electricity Yes, 240v
Toilets Yes
Showers Yes
Cable TV No
Hours ?
some notes

This template was designed to create an infobox that is specific to an article about a marina:

{{infobox marina 
|||N|||E
| name=
| lat=
| lon=
| zoom=
| vhf=
| phone=
| mobile=
| fax=
| email=
| web=
| berths=
| maxlength=
| maxbeam=
| maxdraft=
| elect=
| water=
| fuel=
| toilets=
| showers=
| laundry=
| internet=
| cabletv=
| hours=
| image=
| imagetext=
| imagewidth=
| address=
| notes=
}}

Example:

{{infobox marina 
|41|14.159|N|9|11.671|E
| gallery= 
| chartlet= 
| vhf= 12
| berths= 400
| maxlength= 35
| maxdraft=
| fuel=	Fuel station
| water= Yes, on berth
| elect= Yes, 240v 
| toilets= Yes
| showers= Yes
| laundry=
| internet=
| wifi=
| cabletv= No
| phone= {{phone|39|789|751936}} 
| email= [email protected]
| web= http://www.portosantateresa.com
| hours=
| image= SantaTeresa.jpg
| imagetext= The port of Santa Teresa
| notes=some notes
}}

It is recommended to use a Phone template (see below) to fill in a phone parameter here, especially if such a number is in international format (which is also recommended).

Infobox canal

Embeddable templates
West Entrance
East Entrance
Corinth Canal.jpg
Magnify-clip.png
Corinth Canal - Photo: NASA

This template was designed to create an infobox that is specific to an article about a canal:

{{infobox canal
| entrance1=
| coord1={{Coord|||N|||E}}
| panoramio1=
| chartlet1=
| entrance2=
| coord2={{Coord|||N|||E}}
| panoramio2=
| chartlet2=
| image=
| imagetext=
}}

Example:

{{infobox canal
| entrance1=West Entrance
| coord1={{Coord|37|57.2|N|22|57.44|E|}}
| panoramio1=http://www.panoramio.com/map/#lt=37.947074&ln=22.954731&z=2&k=0&a=1&tab=2
| chartlet1=http://mapserver.mytopo.com/homepage/index.cfm?lat=37.953333&lon=22.957333&scale=25000&zoom=100&type=0&icon=0&searchscope=dom&CFID=17583484&CFTOKEN=79232580&scriptfile=http://mapserver.mytopo.com/homepage/index.cfm&latlontype=DMS
| entrance2=East Entrance
| coord2={{Coord|37|54.91|N|23|0.61|E|}}
| panoramio2=http://www.panoramio.com/map/#lt=37.915167&ln=23.010167&z=0&k=0&a=1&tab=2
| chartlet2=http://mapserver.mytopo.com/homepage/index.cfm?lat=37.915167&lon=23.010167&scale=750000&zoom=100&type=0&icon=0&searchscope=dom&CFID=17583484&CFTOKEN=79232580&scriptfile=http://mapserver.mytopo.com/homepage/index.cfm&latlontype=DMS
| image=Corinth_Canal.jpg
| imagetext=Corinth Canal - Photo: ''NASA''
}}

Sorry for the mess it caused with the image on the right.

Some helper templates

Image right

Cala Principale, Favignana

This template puts a standard thumbnail of an image at the right side of the page:

Copy and paste:

{{thumb| | }}

Example:

{{thumb|Favignana.jpg|Cala Principale, Favignana}}
EU-Italy.svg
Magnify-clip.png
Location of Italy (dark green) in Europe

This one displays an image from Wikimedia Commons (Wikipedia):

{{thumb|EU-Italy.svg|Location of Italy (dark green) in Europe}}

Phone

Phone number in international format.

Copy & paste:

{{phone|||}}

Example:

{{phone|39|789|751936}}

This expands to:

+39 (789) 751936

Email

Copy & paste:

{{email||}}

This template can be used make an email address visible at the email links.

Compare a traditional:

[mailto:[email protected]]

Which renders to:
[1]

While:

{{email|[email protected]}}

Expands to:

[email protected]

As a convenience another form of this template mimics a traditional syntax:

{{email|[email protected]|Marina email}}

Expands to:

Marina email

Web

Copy & paste:

{{web||}}

This template can be used make an web address visible at the simple external links.

Compare a traditional:

[http://www.portosantateresa.com/]

Which renders to:
[2]

While:

{{web|http://www.portosantateresa.com/}}

Expands to:

http://www.portosantateresa.com/

As a convenience another form of this template mimics a traditional syntax:

{{web|http://www.portosantateresa.com/|Marina web address}}

Expands to:

Marina web address

Personal tools
advertisement
Friends of Cruisers Wiki