Template talk:Geobox image
From Wikipedia, the free encyclopedia
Toto je mapa
|
Contents |
[edit] Fix
Can someone change the code from
...#if: {{{3|}}}|{{{3}}}px|256px}}...
to
...#if: {{{3|}}}|{{px|{{{3}}}}}|256px}}...
As advised here
Template:Px & Wikipedia:ClickFix GameKeeper (talk) 17:54, 28 March 2008 (UTC)
- An example page it should fix is here Sancti Spíritus Province. Good Luck! I'll help check it when it is done. GameKeeper (talk) 17:57, 28 March 2008 (UTC)
-
-
- it fixed Sancti Spíritus Province but broke others like Bratislava . Can it be reverted, I play around a bit more to find why this is. GameKeeper (talk) 18:33, 28 March 2008 (UTC)
-
-
-
-
- I had made a mistake with Bratislava, I needed to purge my cache then it would have looked fine. Can someone redo Elkman's edit, reverting to this version GameKeeper (talk) 19:27, 28 March 2008 (UTC)
-
-
-
-
-
-
- I don't think my first edit was quite enough to fix it. Instead of using the #if formulation, I used the {{ifempty}} formulation and experimented around with it until I got it to work. I'm hoping I have things correct by now. --Elkman (Elkspeak) 20:20, 28 March 2008 (UTC)
-
-
-
Yes, seems you have used {{ifempty}} the right way. But since you did that edit we have added that functionality to {{px}} itself. That is, {{px}} can now take a default value and correctly handles both empty and not defined parameters. So instead of {{px|{{ifempty|{{{3|}}}|256}}}}
you can now simply write {{px|{{{3|}}}|256}}
. Nice, isn't it?
--David Göthberg (talk) 06:31, 29 March 2008 (UTC)
[edit] Image Caption
{{editprotected}} The image captions aren't showing up with ALT tags from this template. It looks like caption (parameter 2) should be moved to be the last paramater passed to Image. Can somebody make this change since this page is protected? Brian Powell (talk) 15:54, 29 April 2008 (UTC)
- Do you mean to use the caption as the ALT text also? This guideline suggests that the default alternative text is best left blank. The caption already appears under the image as seen here Chiltern Hills which seems to make using it as alternative text redundant. Have I missed something ? GameKeeper (talk) 20:34, 29 April 2008 (UTC)
- Yes, I mean to use the caption for the ALT text also. Looking at the code, it appears that this was the intention. As it works now, the code is generating a blank ALT tag. In Firefox, this displays the file name of the image when you hover over it. It seems like having the caption might be a bit more sensible.
- Also, the map caption is being shown as an ALT tag there, so using the caption here would be consistent with the rest of the Geobox. Brian Powell (talk) 21:03, 29 April 2008 (UTC)
- Ah OK I think I understand now. I played around with the template because I want to learn more. As you suggested the order is causing the caption to be lost, this is because when no 4th parameter is passed ( which controls if a border is used) , the [[Image]] is seeing the final parameter as a blank entry. This means the MediaWiki assumes this blank entry is the caption and so removes the previous caption. I believe the following will work (as you suggested).
<includeonly> |- | colspan="2" style="text-align: center; padding: 0.5em;" | <div>[[Image:{{{1|}}}| {{px|{{ifempty|{{{3|}}}|256}}}}|none|{{#if:{{{4|}}}|border}}|{{{2|}}}]]</div>{{#if: {{{2|}}} |<div style="padding-top:0.4em">{{{2}}}</div>}}</includeonly><noinclude>{{pp-template|small=yes}} This is a supportive template for various infoboxes from the [[:Category:Geobox]] series, not intended to be used on its own. Please, see the instructions there. It's a project under construction so the instructions might not be available or up-to-date yet. [[Category:Geobox include|Image]] [[Category:Geobox2 include|image]] </noinclude>
-
- GameKeeper (talk) 21:33, 29 April 2008 (UTC)
[edit] For future editors
Usage {{Geobox image|param#1|param#2|param#3|#param4}}
param#1 , mandatory, is the image name param#2 , mandatory, is the caption and alternative text param#3 , optional , is the image size. Defaults to 256 param#4 , optional , true means use a border. Defaults to no border.
[edit] Examples
{{Geobox image|Ostravice (CZE) - location map.svg|Toto je mapa|200|true}}
gives
|-
| colspan="2" style="text-align: center; padding: 0.5em;" |
{{Geobox image|Ostravice (CZE) - location map.svg|Toto je mapa}}
gives
|-
| colspan="2" style="text-align: center; padding: 0.5em;" |