Template talk:Navbox/Archive 4
This is an archive of past discussions about Template:Navbox. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 | Archive 2 | Archive 3 | Archive 4 | Archive 5 | Archive 6 | → | Archive 10 |
Can the width and placement be changed?
I was wondering a navbox could be made to be only 300 pixels wide and placed on the right side of the screen? Essentially I want to try one as a collapsed infobox to address an issue on a page without an infobox. The navbox would go right above a 300 px wide image. My test version is at User:Ruhrfisch/Frog1. The page I want to try it in is Joseph Priestley House. Thanks in advance for any help, Ruhrfisch ><>°° 20:14, 4 February 2008 (UTC)
- I've added a style parameter to the test page. It's not quite perfect (the title is too wide), but I think this is what you are aming for? — Edokter • Talk • 22:23, 4 February 2008 (UTC)
- Yes, it can; see {{military navigation}}. Kirill 22:24, 4 February 2008 (UTC)
- Thanks very much to both of you - could this be added to the documentation (or did I just miss it there)? Ruhrfisch ><>°° 02:03, 5 February 2008 (UTC)
Not displaying correctly in some browsers
This same navbox was being used as a collapsible infobox in Joseph Priestley House, but while it displayed properly in Internet Explorer (305 pixels wide at the right of the article), it was not showing up this way in Firefox. Please see the bottom of Talk:Joseph_Priestley_House#Infobox_question and these screen shots 1) working in IE, above first photo, 2) not working in Firefox Linux, below first photo (note the box was moved to between the two images in the second screenshot). Is this perhaps due to the recent parser change (bug)? Also note that we have removed the nav box from the article for now - here is the last version with it in [1]. Thanks again in advance for any help with this, Ruhrfisch ><>°° 12:40, 15 February 2008 (UTC)
- It has nothing to do with the parser, just a CSS problem. I made a small tweak on your test page. See if it is working now. — Edokter • Talk • 15:03, 15 February 2008 (UTC)
- Thanks very much - it still is not working in Firefox (my problem is that I use IE, so I am just reporting other people's problems from the article talk page). Could it be caused by translcusion (someone else wondered)? Would a collapsible table work better? Ruhrfisch ><>°° 16:56, 15 February 2008 (UTC)
- Well, the navbox basically is a collapsible table. I'll have a further look when I get home. — Edokter • Talk • 17:18, 15 February 2008 (UTC)
- The odd thing is that the collapsible table is working in regular Firefox (not sure if it is in Linux Firefox). Now I just have to turn the header background color on the table light blue. Ruhrfisch ><>°° 21:44, 15 February 2008 (UTC)
- That is odd... Oh well, as long as it works. I made the header light blue, and changed some attributes to CSS. It still works in Firefox. — Edokter • Talk • 23:17, 15 February 2008 (UTC)
- At least it works now - thanks for all of your help with this. Ruhrfisch ><>°° 00:37, 16 February 2008 (UTC)
Title centering
The titlebar consists of three elements: the navbar (the v • d • e links), the title and [hide]. This is centered properly only if all three elements are used or only the title:
If the either the navbar or the [hide] are disabled, then the title is not centered:
But, this can be fixed by padding the title one way or the other using {{space|12}}
:
Is there a way to add this to the template? Preferably this could be automatic: if state=plain then pad right; if navbar=plain then pad left. If this is not possible, then a pad parameter could be implemented such that pad=left or pad=right adds the correct padding. This does seem to work in both FireFox 2 and IE7. --— Gadget850 (Ed) talk - 12:47, 9 February 2008 (UTC)
- You actually made me discover a little bug (navbar was still pushing the title off-center when set to "plain"). But back on topic... It shouldn't pad automatically; if the navbox is smaller, it would not let the title itself use the available space. Some form of pad parameter could be done, but it wouldn't be use very often. Using {{space}} is not ideal either, as it uses spaces for padding, which is variable depending on the reader's font settings, and the space taken by the navbar and statebox is set static at 6em. I could concoct a template that accepts a measure of em units to include in the title though... — Edokter • Talk • 13:16, 9 February 2008 (UTC)
- OK, I made up the {{pad}} template, which you can put in front or after the title to center it properly. But I found out it {{space}} works just as well... Example below is using 5.5em, as the title font is slighty bigger. Oh well. — Edokter • Talk • 14:04, 9 February 2008 (UTC)
- Thanks— I suggest this go in the doc. When I was searching for padding templates, "pad" was actually my first guess (finding the right template is sometimes a pain). --— Gadget850 (Ed) talk - 14:11, 9 February 2008 (UTC)
- As we say on Wikipedia: be bold! — Edokter • Talk • 14:15, 9 February 2008 (UTC)
- Done! As we say on Wikipedia, edit mercilessly! --— Gadget850 (Ed) talk - 14:24, 9 February 2008 (UTC)
- I noticed that 5.5em doesn't center it exactly (it pushes the title over a little too far), but most people are probably never going to notice... Anyways, I updated the documentation with a note about omitting both the navbar and the Show/Hide link, and I added a 'default' example for comparison. —Dinoguy1000 18:12, 9 February 2008 (UTC)
You are right— 5.5em padding:
5.3em padding:
Probably only noticeable with a very short title and a very short list1. --— Gadget850 (Ed) talk - 18:26, 9 February 2008 (UTC)
- It's also slighly dependent on font sizes used. Since the title uses a bigger font, 6em was too much. 5.5em seems OK, as it hoovers around the center depending on the page's font size/user's font settings. (It only differs only one pixel on my screen.) — Edokter • Talk • 18:31, 9 February 2008 (UTC)
Large "What links here" display
If a Navbox contains links to articles A, B, and C, and then each of those articles A, B, and C includes that Navbox, the result is that A, B, and C all become linked to each other, so that a "What links here" from article A displays the names of articles B and C.
Example: {{2008Demprimaries}} contains links to more than 50 articles such as Minnesota Democratic caucuses, 2008 and Missouri Democratic primary, 2008. Each of those articles includes {{2008Demprimaries}}.
If the number of the links in the Navbox is large (as in the example), the result is a large "What links here" display from any of those linked articles. This makes it difficult to see any backlinks that weren't generated as a side-effect of so many articles including (and being linked from) the Navbox. Is there any way to prevent that? Or would doing so be against the spirit of "What links here"?.
Wdfarmer (talk) 21:56, 9 February 2008 (UTC)
- You can select the name space at the top of the "What links here" page so that it only shows links from articles. — Edokter • Talk • 23:44, 9 February 2008 (UTC)
- That helps some, but the list still contains all the article backlinks that were generated by the more than 50 articles including {{2008Demprimaries}}. Wdfarmer (talk) 00:58, 11 February 2008 (UTC)
- This is explained in depth at Help:What links here. I don't know of any way to supress the backlinks. --— Gadget850 (Ed) talk - 03:15, 11 February 2008 (UTC)
Documented 4th state as show
15-Feb-2008: For the part documenting state (lost in the massive blurb), I just added "show" to list 4 no-shaggy-dog-story values: autocollapse, show, collapsed, or plain. I also added the 4th value "show" to demonstrate a new four-issue option: for showing the box if standalone, plus having "[hide]", even with other boxes, but autohide in articles -- that 4-issue option was just too confusing without "show":
- To show the box when standalone (non-included) but then auto-hide contents when in an article, put "show" inside <noinclude> tags:
state =
<noinclude>show</noinclude><includeonly>autocollapse</includeonly>
- That double setting will force the box visible when standalone (even when followed by other boxes), displaying "[hide]" but then auto-collapse the box when stacked inside an article.
I left the detailed wording about "oh, just anything else will also do something useful" but noted "(such as 'show' )". Kids don't do this: please don't pyramid confusion by coding functionality as "tricks of omission" (such as "no news is good news") of default settings, then really gig it by telling people they can get more functionality by using more "tricks" (such as passing a parameter called "state"). Instead, in the next lifetime, really write code that has a 4th value named "show" then consider reporting "curlapsed" as an invalid spelling not a youre-gonner-get a neat default show-action now, buddy, because "curlapsed" is just as good as "show" since we default anything to mean show box (but hey at least, you can call it a trick). Sorry, if I seem too angry. Actually, I'm quite pleased that Template:Navbox has all these capabilities. Anyway, now there is a 4th value named "show" on the doc subpage. -Wikid77 (talk) 04:11, 15 February 2008 (UTC)
Newbie Question
Hi everyone, I have been developing my own wiki centered around a musician and think the navbox would make a great addition. I spent all night trying to figure out how to port the navbox template over to my wiki but was unable to do so. Can someone please explain to me all the steps that are required to make this happen? I saw the post above about copying over the template, but I tried this and it didn't work. I am using v 1.11.1 of mediawiki. my site is here http://www.gremmie.net/doughty/wiki/index.php?title=Main_Page —Preceding unsigned comment added by Freealcibiades (talk • contribs) 17:51, 21 February 2008 (UTC)
Suggestions for default groupstyle/liststyle, groupNstyle/listNstyle
Hi. Fred Bradstadt had been doing some template mopwork and happened to amend a template I'd formatted (Template:Isaac Asimov novels) thus: http://wiki.riteme.site/w/index.php?title=Template%3AIsaac_Asimov_novels&diff=193565795&oldid=193438452
My subsequent observation:
- ... Without the kind of groupstyle/liststyle assignments removed by the above, the spacing between lines within a group and lines between groups becomes far less easy to distinguish, the alternating white/grey backgrounds notwithstanding...
He suggested I bring my observation here to see if there'd be any consensus to use as navbox defaults the groupstyle/liststyle formatting I'd originally applied to the template linked above (i.e. |groupstyle = line-height:1.1em; |linestyle = line-height:1.4em;) for the reason quoted above.
If there is any consensus for this kind of amendment, I realize a little top and bottom padding (say 0.33em) would need to be added to the groupstyle default to prevent groups consisting of one-line lists from being squeezed too close together (see example templates below).
My other thought is that the Navbox code might also be amended to handle "groupNstyle" and "listNstyle" parameters (where N is the group number) for those occasions when groups/lists are used more creatively (e.g. a list used to create a heading-with-background within a template).
Here's some versions of the Isaac Asimov novels template that try to illustrate the groupostyle/liststyle observation:
What do people think? Hope it all makes some sense. Sardanaphalus (talk) 03:33, 25 February 2008 (UTC)
- Of all the examples, only the last one looks acceptable. The other have severe padding issues, and has text spaced too close together. — Edokter • Talk • 15:28, 25 February 2008 (UTC)
- I agree and wonder if anyone else does as well - or, if there's no further response, whether the amendments producing the last example could be implemented. Sardanaphalus (talk) 14:06, 27 February 2008 (UTC)
- As far as I remember, the recommendation is to specify the CSS line-height parameter as a “number” rather than as a “length.” Thus, the 4th example above should be changed to contain the following lines:
- I agree and wonder if anyone else does as well - or, if there's no further response, whether the amendments producing the last example could be implemented. Sardanaphalus (talk) 14:06, 27 February 2008 (UTC)
|groupstyle = padding:0.35em 1em; line-height:1.1; |liststyle = line-height:1.4;
- I assume the titlestyle parameter is just for the example, not as part of the suggestion… –Fred Bradstadt (talk) 09:38, 28 February 2008 (UTC)
- I imagine, though, that including font-proportional units (i.e. "em") is necessary, so the lengths may change in proportion with the basic text-size used or set for each browser...? Sardanaphalus (talk) 13:13, 28 February 2008 (UTC)
- Nope, as mentioned here, “a number value is used as a multiplier in the calculation of the value used for this property, which equals the specified number multiplied by the element’s computed font size. Child elements will inherit the specified value, not the resulting used value for this property.” I guess the recommendation of number values rather than lengths is that it works out better when having child elements. When not having child elements, the two approaches give the same result, no there’s really no reason for using lengths (i.e. “em”). –Fred Bradstadt (talk) 14:12, 28 February 2008 (UTC)
- Thanks for this information. So, to make sure I understand this correctly, does
line-height:1.4;
=line-height:1.4em;
? Sardanaphalus (talk) 14:33, 28 February 2008 (UTC)- For this purpose, yes – for a short answer :-) –Fred Bradstadt (talk) 15:22, 28 February 2008 (UTC)
- Thanks for this information. So, to make sure I understand this correctly, does
- Nope, as mentioned here, “a number value is used as a multiplier in the calculation of the value used for this property, which equals the specified number multiplied by the element’s computed font size. Child elements will inherit the specified value, not the resulting used value for this property.” I guess the recommendation of number values rather than lengths is that it works out better when having child elements. When not having child elements, the two approaches give the same result, no there’s really no reason for using lengths (i.e. “em”). –Fred Bradstadt (talk) 14:12, 28 February 2008 (UTC)
- I imagine, though, that including font-proportional units (i.e. "em") is necessary, so the lengths may change in proportion with the basic text-size used or set for each browser...? Sardanaphalus (talk) 13:13, 28 February 2008 (UTC)
- I'm finding that including the "em" seems necessary for width: and padding: settings to work, so, for the sake of consistency, have returned to including it with line-height: settings too. Sardanaphalus (talk) 20:11, 1 March 2008 (UTC)
Request
{{editprotected}}
Per Fred Bradstadt's advice here, I request that lines 27-29 of the code - currently:
|gs = white-space:nowrap;background:#ddddff;text-align:right;{{{groupstyle|}}} |os = width:100%;font-size:95%;{{{liststyle|}}}{{{oddstyle|}}} |es = width:100%;font-size:95%;background:#f7f7f7;{{{liststyle|}}}{{{evenstyle|}}}
are amended to:
|gs = white-space:normal;background:#ddddff;text-align:right;line-height:1.1;padding-top:0.35em;padding-bottom:0.35em;{{{groupstyle|}}} |os = width:100%;font-size:95%;line-height:1.4;{{{liststyle|}}}{{{oddstyle|}}} |es = width:100%;font-size:95%;line-height:1.4;background:#f7f7f7;{{{liststyle|}}}{{{evenstyle|}}}
This should enable the formatting discussed above (specifically the benefits indicated in the "..... as above but now 0.35em top/bottom padding added to groupstyle so distinction between groups and wrapped lists maintained" example) to become the norm. Thanks. Sardanaphalus (talk) 01:26, 2 March 2008 (UTC)
- I have to respectfully decline this request. The reason being that the ammount of CSS should be kept to an absolute minimum in the template itself. (The CSS you de see is only there because it cannot be defined as a class.) Changes like these should be made in common.css, where the .navbox class is defined. And even then, changing the lineheight is not considered a good idea as it breaks consistency between elements. — Edokter • Talk • 11:20, 2 March 2008 (UTC)
- Thanks for the information. Would changing the line-height be considered a good idea on the grounds of distinguishing between groups and lists that linewrap? Sardanaphalus (talk) 03:43, 3 March 2008 (UTC)
- Basically, that is why the group lists have alternating colors, as well as 2px padding between the group cells. — Edokter • Talk • 15:10, 3 March 2008 (UTC)
- Unfortunately, that doesn't work too well, as the "Without"/"With" examples are meant to show here. Sardanaphalus (talk) 16:16, 3 March 2008 (UTC)
Also, using [nowrap begin]-[·w]-[·w]-etc-[nowrap end] for better linewrap management within lists
I'd also appreciate knowing whether or not it's possible to code this template to detect whether it's being used with {{·w}} (i.e. {{·wrap}}) so that it can then place {{nowrap begin}}s and {{nowrap end}}s at the starts/ends of each listN automatically (see User talk:Sardanaphalus#Template Q). If it is possible, may this also be done please? Thanks again. Sardanaphalus (talk) 01:40, 2 March 2008 (UTC)
- That's not possible. A template can't detect the use of another template inside it. — Edokter • Talk • 11:34, 2 March 2008 (UTC)
- Useful to know; thanks. I guess that means {{nowrap begin}} and {{nowrap end}} will need to be included at the starts/ends of lists within templates using {{·w}}, as I imagine including them with the list-handling code itself will probably cause other formats to malfunction. Sardanaphalus (talk) 03:46, 3 March 2008 (UTC)
Redlinks for view
The navbox {{UKlegislation}} has a redlink for view. Why is this and how do I fix it?Cutler (talk) 12:18, 27 February 2008 (UTC)
- You have name = UK legislation where it should be UKlegislation. --— Gadget850 (Ed) talk - 12:37, 27 February 2008 (UTC)
- Sorted! Sardanaphalus (talk) 14:15, 27 February 2008 (UTC)