Difference between revisions of "Template:Icon"
m |
m (Many little corrections) |
||
Line 1: | Line 1: | ||
− | <div style= | + | <div style= <!--> Quite simple concat string<--> |
{{ #switch:{{{2}}} | {{ #switch:{{{2}}} | ||
| 1 = "float: left; align: top; | | 1 = "float: left; align: top; | ||
Line 12: | Line 12: | ||
}} | }} | ||
">[[Image:{{ #switch:{{{1}}} | ">[[Image:{{ #switch:{{{1}}} | ||
− | |||
− | |||
− | |||
− | |||
| Base = Base | | Base = Base | ||
| Calc = Calc | | Calc = Calc | ||
Line 29: | Line 25: | ||
This template use the #switch function of the [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions ParserFunctions extension]. | This template use the #switch function of the [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions ParserFunctions extension]. | ||
− | General syntax is : <div style="{{{Position}}}">[[Image:{{{1}}}.png|{{{3}}}px]]</div> | + | General syntax is : <code><nowiki><div style="{{{Position}}}">[[Image:{{{1}}}.png|{{{3}}}px]]</div></nowiki></code> |
− | For parameter 2 (position) only values 1 & 3 actually works. | + | For parameter 2 (position) only values 1 & 3 actually works. |
− | + | Valid expressions | |
− | + | Left | |
− | + | Right | |
− | + | Unvalid expressions | |
− | + | Center | |
− | + | Middle | |
− | + | Top | |
− | + | Bottom | |
− | + | ||
I see no reason for that I couldn't work. So you can : | I see no reason for that I couldn't work. So you can : | ||
Line 52: | Line 47: | ||
;1. Module : Seven values available | ;1. Module : Seven values available | ||
+ | :Displayed below. To permit another icon it need to be registered in this template. | ||
;2. Position : | ;2. Position : | ||
{| | {| | ||
Line 79: | Line 75: | ||
{| border="1" style="width: 800px; height: 120px;" | {| border="1" style="width: 800px; height: 120px;" | ||
|- | |- | ||
− | ! 2nd Parameter: Position. Mapping: | + | ! 2nd Parameter: Position. Mapping : |
− | ! | + | ! An example of call with Calc : |
! No template called here : | ! No template called here : | ||
|- | |- | ||
Line 112: | Line 108: | ||
The result is now a 40 pixels floating Calc icon, at the top right of the cell... The result is now a 40 pixels floating Calc icon, at the top right... | The result is now a 40 pixels floating Calc icon, at the top right of the cell... The result is now a 40 pixels floating Calc icon, at the top right... | ||
|- | |- | ||
− | ! Colspan=3 | | + | ! Colspan=3 | Nine real examples ordered by position (Template calls) |
|- | |- | ||
|{{Icon|Impress|1|120}} | |{{Icon|Impress|1|120}} | ||
Line 121: | Line 117: | ||
<code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. | <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. | ||
|- | |- | ||
− | |{{Icon|Edit|4|60}}Edit | + | |{{Icon|Edit|4|60}}This is the Edit icon align 4 (mid-left) and size of 60pixels. It's also the default icon, and that who's choosen when names don't match. If you have an error, it will be this one displayed. A call with the string "General" will display this icon, since there's not General.png. |
− | |{{Icon|Draw|5|75}}Draw | + | |{{Icon|Draw|5|75}}The Draw Icon displayed in 75 pixels. Should be in the center of the cell, cause "Position"=5 |
− | |{{Icon|Writer|6|90}}Writer | + | |{{Icon|Writer|6|90}}This icon for Writer is displayed in a comfortable 90 pixels size, but with a position of 6 should be aligned mid-right. |
+ | |- | ||
+ | |{{Icon|Calc|7|90}}90 pixels size also for this icon of Calc which should display at the bottom Left of the cell. | ||
+ | |{{Icon|Setup|8|35}}A call with "Setup" in 35 pixels, aligned center-bottom | ||
+ | |{{Icon|Unix|9|200}}A fantaisist call to "Unix" in a huge icon of 200 pixels, who should be displayed in the last position 9, thus bottom right. | ||
|} | |} | ||
Revision as of 21:50, 23 May 2009
This template use the #switch function of the ParserFunctions extension.
General syntax is : <div style="{{{Position}}}">[[Image:{{{1}}}.png|{{{3}}}px]]</div>
For parameter 2 (position) only values 1 & 3 actually works. Valid expressions Left Right Unvalid expressions Center Middle Top Bottom
I see no reason for that I couldn't work. So you can :
- Help me.
- Be patient.
- Explain briefly why I could never be valid. or make me discover another existing simple syntax for this possibility.
Help
This template use three (numbered=default) parameters :
- 1. Module
- Seven values available
- Displayed below. To permit another icon it need to be registered in this template.
- 2. Position
Nine values from 1 to 9
|
|
- 3. Size in pixels
- Optional, thus in third position. Max size if ignored.
- Examples in table cells
2nd Parameter: Position. Mapping : | An example of call with Calc : | No template called here : | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
{{Icon|Calc|3|40}} |
The result is now a 40 pixels floating Calc icon, at the top right of the cell... The result is now a 40 pixels floating Calc icon, at the top right... | |||||||||||
Nine real examples ordered by position (Template calls) | |||||||||||||
Impress icon is called with |
The icon for Math, 60 pixels top-centered. Call |
| |||||||||||
|
|
| |||||||||||
|
|
|