Khác biệt giữa bản sửa đổi của “Bản mẫu:Hộp thông tin/doc”

Nội dung được xóa Nội dung được thêm vào
Không có tóm lược sửa đổi
Không có tóm lược sửa đổi
Dòng 16:
}}
<includeonly>{{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2 }} | old | <!-- null --> | {{lua|Module:Infobox}} }}</includeonly>
{{Documentation subpage}}
[[Tập tin:Unified infobox sample, Hungarian Wikipedia.png|right]]
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE. -->
Bản mẫu này được sử dùng để viết các bản mẫu khác. Nó không được khuyến khích dùng trực tiếp vào bài viết, tuy nhiên vẫn có thể dùng được trong trường hợp cần thiết. Xem [[:en:Help:Infobox]] về hướng dẫn viết hộp thông tin và cách thức viết chúng. Tham khảo [[Wikipedia:Cẩm nang biên soạn]] và [[:Thể loại:Bản mẫu hộp thông tin]] để xem các bản mẫu đã viết.
<includeonly>{{Intricate template}}</includeonly>
==Sử dụng==
Bản mẫu này là một bản mẫu meta, được sử dụng để xây dựng các bản mẫu khác. Nó không nên được sử dụng trực tiếp trong một bài viết. Xem [[:en:Help:Hộp thông tin]] để biết thông tin về cách tạo các hộp thông tin nói chung. Tham khảo [[Wikipedia:Cẩm nang biên soạn]] và [[Thể loại:Bản mẫu hộp thông tin]] để xem các bản mẫu đã viết.
 
Cách sử dụng tương tự như {{tl|navbox}}, nhưng với một sự phân biệt bổ sung. Mỗi hàng trên bảng có thể là một "đầu đề" (header) hoặc nó có thể có một cặp nhãn/dữ liệu (label/data) hoặc nó chỉ có thể là một ô dữ liệu. Đây là các trạng thái loại trừ lẫn nhau, vì vậy nếu bạn xác định một hàng vừa là tiêu đề vừa là cặp nhãn/dữ liệu (label/data), cặp nhãn/dữ liệu (label/data) sẽ bị ghi đè.
This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See [[Help:Infobox]] for an introduction to infoboxes and information on how to design them. See [[:Category:Infobox templates]] for specific infobox templates.
 
Lưu ý rằng nếu bạn muốn chèn một hình ảnh ở nơi khác ngoài đầu hộp thông tin hoặc chèn các dữ liệu "dạng tự do" khác, sử dụng một hàng chỉ với trường "dữ liệu" (data) sẽ cho phép điều đó.
=== Usage ===
Usage is similar to {{tl|navbox}}, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.
 
===Tham số===
To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.
Để đảm bảo hộp thông tin hiện được thông tin, cần có ít nhất một hoặc nhiều tham số sau:
 
;name : Tên trang bản mẫu mà liên kết "x/t/s" bên dưới nên trỏ đến. Bạn có thể dùng <nowiki>{{subst:PAGENAME}}</nowiki>.
=== Optional control parameters ===
;title : Một tiêu đề để đặt vào thanh tiêu đề ở trên cùng.
; name : If this parameter is present, "view/discuss/edit" links will be added to the bottom of the infobox, pointing to the named page. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however this is rarely what you want, because it will send users clicking these links in an infobox in an article to the template code rather than the data in the infobox that they probably want to change.
Nếu không có tên hoặc tiêu đề được đưa ra, pagename (tên trang) được sử dụng.
; child : See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
; image : Một hình ảnh để hiển thị ở trên cùng của bản mẫu. Sử dụng cú pháp hình ảnh đầy đủ, ví dụ <nowiki>[[Image:example.png|200px]]</nowiki>. Hình ảnh được căn giữa theo mặc định.
; subbox : See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes".
;caption : Văn bản đặt bên dưới hình ảnh.
; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
;header(n) : Văn bản để sử dụng làm đầu đề trong hàng n.
;label(n): Văn bản để sử dụng làm một nhãn trong hàng n.
;data(n): Văn bản để hiển thị dưới dạng dữ liệu trong hàng n.
;below: Văn bản để đặt trong ô dưới cùng. Các ô dưới cùng được dành cho chú thích, xem thêm và các thông tin khác như vậy.
 
=== Content parameters ===
 
Kiểu CSS tùy chọn:
==== Title ====
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):
 
;bodystyle : Áp dụng cho toàn bộ bảng thông tin
; title : Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
;titlestyle : Chỉ áp dụng cho ô tiêu đề (title)
; above : Text to put within the uppermost cell of the table.
;imagestyle : Áp dụng cho ô mà hình ảnh nằm trong (bao gồm cả chú thích (caption))
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.
;captionstyle : Áp dụng cho văn bản của chú thích (caption)
;headerstyle : Áp dụng cho tất cả các ô đầu đề (header)
;labelstyle : Áp dụng cho tất cả các ô nhãn (label)
;datastyle :Áp dụng cho tất cả các ô dữ liệu (data)
;belowstyle : Chỉ áp dụng cho các ô bên dưới (below)
 
===Làm cho các tham số tùy chọn===
Examples:
 
Một hàng có nhãn nhưng không có dữ liệu không được hiển thị. Điều này cho phép tùy chỉnh nội dung hộp thông tin. Để làm cho một tham số tùy chọn, sử dụng một tham số mặc định thành một chuỗi trống, như thế này:
{{Hộp thông tin
| name = Hộp thông tin/doc
| title = Text in caption over infobox
| subheader = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<pre style="overflow:auto">
{{Hộp thông tin
| name = {{subst:PAGENAME}}
| title = Text in caption over infobox
| subheader = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</pre>{{clear}}
 
<pre>
{{Hộp thông tin
|data5={{{population|}}}
| name = Hộp thông tin/doc
</pre>
| above = Text in uppermost cell of infobox
| subheader = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
<pre style="overflow:auto">
{{Hộp thông tin
| name = {{subst:PAGENAME}}
| above = Text in uppermost cell of infobox
| subheader = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
</pre>{{clear}}
 
Đối với các trường phức tạp hơn với nội dung được định dạng sẵn vẫn sẽ xuất hiện nếu một tham số không được đặt, bạn có thể gói tất cả trong một câu lệnh "nếu" (If) đơn giản để làm cho toàn bộ nội dung biến mất khi không được sử dụng. Thí dụ:
==== Illustration images ====
; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text. Image parameters should not be spaced more than 10 apart.
; caption(n) : Text to put underneath the images.
 
<pre>
==== Main data ====
|data5= {{#if: {{{mass|}}} | {{{mass}}} kg}}
; header(n) : Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
; label(n) : Text to use as a label in row n.
; data(n) : Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.
 
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{Thông số|header''(n)''}} will cause the corresponding {{Thông số|data''(n)''}} (and {{Thông số|rowclass''(n)''}} {{Thông số|label''(n)''}}, see below) to be ignored; the absence of a {{Thông số|data''(n)''}} will cause the corresponding {{Thông số|label''(n)''}} to be ignored. Valid combinations for any single row are:
 
* {{Thông số|class''(n)''}} {{Thông số|header''(n)''}}
* {{Thông số|rowclass''(n)''}} {{Thông số|class''(n)''}} {{Thông số|data''(n)''}}
* {{Thông số|rowclass''(n)''}} {{Thông số|label''(n)''}} {{Thông số|class''(n)''}} {{Thông số|data''(n)''}}
 
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.
 
===== Number ranges =====
To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:
 
<pre style="overflow:auto">
| header3 = Section 1
| label5 = Label A
| data5 = Data A
| label7 = Label C
| data7 = Data C
| header10 = Section 2
| label12 = Label D
| data12 = Data D
</pre>{{clear}}
 
It is also possible to automatically renumber parameter names by using [[Module:IncrementParams]].
 
Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the [[#Limitations]] section below for more details.
 
====Tiêu đề "thủ công"====
Ngoài ra còn có khả năng thiết kế các tiêu đề tùy chỉnh cho các thẻ chủ đề mà không sử dụng tham số <code>clasetitulo=</code>, sửa đổi một chút mã của mẫu của loại thẻ mà bạn muốn điều chỉnh. Bất kỳ loại hình ảnh nào được xử lý trong wikipedia đều có thể được sử dụng làm biểu tượng, mặc dù để duy trì tính đồng nhất với các tệp khác, bạn nên sử dụng các biểu tượng bán trong suốt, nằm trong {{commonscat|Infobox pictograms}}.
 
'''Ejemplo:'''
 
'''Código:''' (cabecera de la ficha)
 
{{Hộp thông tin
| italic title = {{{italic title|}}}
| bodyclass = {{#ifeq:{{{collapsible|}}}|yes|collapsible {{{state|autocollapse}}}}} infobox vevent
| bodystyle = box-shadow:8px 8px 8px #CCC; {{#if:{{{align|}}}|float: {{{align}}};}} {{#if:{{{width|}}}|{{{width}}}}}
| aboveclass = fn
| labelstyle = background: #E6E6E6;
| abovestyle = background-color:#CCF;font-size:110%;font-style:italic;
| headerstyle = background-color: #4682b4; color: white
| above =
| title= {{Hộp thông tin/Định dạng đầu|t
|tên=''{{if empty|{{{title|}}}|{{{Title|}}}|{{PAGENAMEBASE}}}}''
|màu=95d3eb
|icon= Picto infobox gamepad.png
|iconsize = 55px
}}
}}
<pre style="overflow:auto; overflow-x: scroll">
{{Hộp thông tin
| italic title = {{{italic title|}}}
| bodyclass = {{#ifeq:{{{collapsible|}}}|yes|collapsible {{{state|autocollapse}}}}} infobox vevent
| bodystyle = box-shadow:8px 8px 8px #CCC; {{#if:{{{align|}}}|float: {{{align}}};}} {{#if:{{{width|}}}|{{{width}}}}}
| aboveclass = fn
| labelstyle = background: #E6E6E6;
| abovestyle = background-color:#CCF;font-size:110%;font-style:italic;
| headerstyle = background-color: #4682b4; color: white
| above =
| title= {{Hộp thông tin/Định dạng đầu|t
|tên=''{{if empty|{{{title|}}}|{{{Title|}}}|{{PAGENAMEBASE}}}}''
|màu=95d3eb
|icon= Picto infobox gamepad.png
|iconsize = 55px
}}
}}
</pre>
 
===Ví dụ===
Basta con configurar el parámetro <code>colorfondotitulo</code> y elegir la imagen deseada (en el ejemplo, <code>Picto infobox gamepad.png</code>) para personalizar la ficha que se se desee (por ejemplo, ''[[:Plantilla:Ficha de automóvil]]'').
 
'''Notas:'''
* El tamaño de los iconos es <code>x45px</code>. Para que la plantilla funcione correctamente, algunos iconos necesitan que se declare necesariamente su altura (con la citada notación '''x'''45px).
* También es imprescindible NO ALTERAR la secuencia de los comandos <code><nowiki><div>...</div></nowiki></code>. Si se desordenan o agrupan, lo más probable es que el código deje de funcionar correctamente.
 
===== Making data fields optional =====
A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:
 
<pre style="overflow:auto">
| label5 = Population
| data5 = {{{population|}}}
</pre>{{clear}}
 
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.
 
For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":
 
<pre style="overflow:auto">
| label6 = Mass
| data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}
</pre>{{clear}}
 
For more on #if, see [[meta:ParserFunctions##if:|here]].
 
===== Hiding headers when all data fields are hidden =====
You can also make headers optional in a similar way. Consider this example:
{{Hộp thông tin
|name = Hộp thông tin/doc
| title = Example of an undesirable header
|bodystyle =
| header1 = Undesirable header
|title label2 = Item 1 = Test Hộp |thông data2 =tin
|titlestyle =
| label3 = Item 2 | data3 =
| label4 = Item 3 | data4 =
| header5 = Static header
| label6 = Static item | data6 = Static value
}}
<pre style="overflow:auto">
{{Hộp thông tin
| title = Example of an undesirable header
| header1 = Undesirable header
| label2 = Item 1 | data2 =
| label3 = Item 2 | data3 =
| label4 = Item 3 | data4 =
| header5 = Static header
| label6 = Static item | data6 = Static value
}}
</pre>{{clear}}
 
|image = [[File:example.png|200px|alt=Example alt text]]
If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:
|imagestyle =
|caption = Caption for example.png
|captionstyle =
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
 
|header1 = Header defined alone
{{Hộp thông tin
|label1 =
| title = Example of an optional header
|data1 =
| header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
|header2 =
| label2 = Item 1 | data2 = {{{item1|}}}
|label2 = Label defined alone does not display (needs data, or is suppressed)
| label3 = Item 2 | data3 = {{{item2|}}}
|data2 =
| label4 = Item 3 | data4 = {{{item3|}}}
|header3 =
| header5 = Static header
|label3 =
| label6 = Static item | data6 = Static value
|data3 = Data defined alone
}}
|header4 = All three defined (header, label, data, all with same number)
<pre style="overflow:auto">
|label4 = does not display (same number as a header)
{{Hộp thông tin
| titledata4 = Exampledoes not display (same ofnumber anas optionala header)
|header5 =
| header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
|label5 = Label and data defined (label)
| label2 = Item 1 | data2 = {{{item1|}}}
|data5 = Label and data defined (data)
| label3 = Item 2 | data3 = {{{item2|}}}
| label4 = Item 3 | data4 = {{{item3|}}}
| header5 = Static header
| label6 = Static item | data6 = Static value
}}
</pre>{{clear}}
 
|belowstyle = background:#ddf;
header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.
|below = Below text
 
Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a [[#Subboxes|subbox]]). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),
 
==== Footer ====
; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.
 
=== Presentation parameters ===
 
==== Italic titles ====
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter.
 
* Turn on italic titles by passing {{Thông số|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox.
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{Thông số|italic title|<nowiki>{{{italic title|no}}}</nowiki>}}
* Do not make any titles italic by not passing the parameter at all.
 
==== CSS styling ====
; bodystyle : Applies to the infobox table as a whole
; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
; captionstyle : Applies to the text of the image caption.
; headerstyle : Applies to all header cells
; labelstyle : Applies to all label cells
; datastyle : Applies to all data cells
; belowstyle : Applies only to the below cell
 
=== HTML classes and microformats ===
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption.
<!-- currently not implemented in Lua module
; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on.
-->
; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell.
; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on.
; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''.
; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on.
; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''.
; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells.
; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect.
<!-- currently not implemented in Lua module
; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on.
-->
; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell.
 
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others beig used for microformats.
 
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:
 
<pre style="overflow:auto">
| bodyclass = vcard
</pre>{{clear}}
 
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
 
<pre style="overflow:auto">
| class1 = fn
| class2 = org
| class3 = tel
</pre>{{clear}}
 
...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.
 
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.
 
=== Examples ===
Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell :
 
{{Hộp thông tin
|name = Hộp thông tin/doc
|bodystyle =
 
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|above = Above text
|subheader = Subheader above image
|subheader2 = Second subheader
 
|imagestyle =
|captionstyle =
|image = [[File:example.png|200px|alt=Example alt text]]
|caption = Caption displayed below example.png
 
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
 
|header1 = Header defined alone
| label1 =
| data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
| data2 =
|header3 =
| label3 =
| data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
| data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
| data5 = Label and data defined (data)
 
|belowstyle = background:#ddf;
|below = Below text
}}
<pre style="overflow:auto">
{{Hộp thông tin
|name = {{subst:PAGENAME}}
|bodystyle =
 
<pre style="overflow:auto">{{Hộp thông tin
|titlestyle =
|name = Hộp thông tin/doc
|abovestyle = background:#cfc;
|bodystyle =
|subheaderstyle =
|title = Test InfoboxHộp thông tin
|above titlestyle = Above text
|subheader = Subheader above image
|subheader2 = Second subheader
 
|image = [[File:example.png|200px|alt=Example alt text]]
|imagestyle =
|captionstyleimagestyle =
|caption image = Caption =for [[File:example.png|200px|alt=Example alt text]]
|captionstyle =
|caption = Caption displayed below example.png
|headerstyle = background:#ccf;
|labelstyle = background:#ddf;
|datastyle =
 
|header1 = Header defined alone
|headerstyle = background:#ccf;
|label1 =
|labelstyle = background:#ddf;
|datastyle data1 =
|header2 =
|label2 = Label defined alone does not display (needs data, or is suppressed)
|data2 =
|header3 =
|label3 =
|data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
|label4 = does not display (same number as a header)
|data4 = does not display (same number as a header)
|header5 =
|label5 = Label and data defined (label)
|data5 = Label and data defined (data)
 
|belowstyle = background:#ddf;
|header1 = Header defined alone
|below = Below text
| label1 =
}}</pre>
| data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
| data2 =
|header3 =
| label3 =
| data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
| data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
| data5 = Label and data defined (data)
 
Lưu ý cách khi nhãn (label) được xác định mà không có ô dữ liệu (data) đi kèm, hàng không xuất hiện trong hộp thông tin sẽ được hiển thị và khi tiêu đề được xác định trên cùng một hàng với tất cả các ô dữ liệu sẽ được hiển thị.
|belowstyle = background:#ddf;
|below = Below text
}}
</pre>{{clear}}
 
{{clear}}
For this example, the '''bodystyle''' and '''labelstyle''' parameters are used to adjust the infobox width and define a default width for the column of labels:
Ví dụ này, {{nowrap|bodystyle &#0061; width:20em;}} and {{nowrap|labelstyle &#0061; width:33%;}}
 
{{Hộp thông tin
|bodystyle = width:20em;
|name = Hộp thông tin/doc
|name = Hộp thông tin/doc
|bodystyle = width:20em
|title = Test Hộp thông tin
 
|titlestyle =
|headerstyle =
|title = Test Infobox
|labelstyle = width:33%
 
|headerstyledatastyle =
|labelstyle = width:33%
|datastyle =
 
|header1 =
| label1 = Label 1
|data1 data1 = Data 1
|header2 =
| label2 = Label 2
|data2 data2 = Data 2
|header3 =
| label3 = Label 3
|data3 data3 = Data 3
|header4 = Header 4
| label4 =
|data4 data4 =
|header5 =
| label5 = Label 5
|data5 data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
|belowstyle =
|below = Below text
}}
<pre style="overflow: auto">
{{Hộp thông tin
|name bodystyle = {{substwidth:PAGENAME}}20em;
|name = Hộp thông tin/doc
|bodystyle = width:20em
|title = Test Hộp thông tin
|titlestyle =
|headerstyle =
|labelstyle = width:33%
|datastyle =
 
|titlestyle header1 =
|title label1 = TestLabel Infobox1
|data1 = Data 1
|header2 =
|label2 = Label 2
|data2 = Data 2
|header3 =
|label3 = Label 3
|data3 = Data 3
|header4 = Header 4
|label4 =
|data4 =
|header5 =
|label5 = Label 5
|data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
|headerstylebelowstyle =
|below = Below text
|labelstyle = width:33%
|datastyle =
 
|header1 =
| label1 = Label 1
| data1 = Data 1
|header2 =
| label2 = Label 2
| data2 = Data 2
|header3 =
| label3 = Label 3
| data3 = Data 3
|header4 = Header 4
| label4 =
| data4 =
|header5 =
| label5 = Label 5
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
|belowstyle =
|below = Below text
}}
</pre>
{{clear}}
 
=== Embedding ===
One infobox template can be embedded into another using the {{Thông số|child}} parameter. This feature can be used to create a modular infobox, or to create more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{Hộp thông tin}}</nowiki></code>.
 
===Nhúng===
Một bản mẫu hộp thông tin có thể được nhúng vào một mẫu khác bằng cách sử dụng tham số {{para|child}}. Tính năng này có thể được sử dụng để tạo hộp thông tin mô-đun hoặc để tạo các phần logic được xác định rõ hơn.
{{Hộp thông tin
| title = Top level title
| data1 = {{Hộp thông tin| decat =
yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{Hộp thông tin| decat =
yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
<pre style="overflow:auto">
{{Hộp thông tin
| title = Top level title
| data1 = {{Hộp thông tin| decat =
yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{Hộp thông tin| decat =
yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
|belowstyle =
</pre>{{clear}}
|below = Below text
 
Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using
 
{{Hộp thông tin
| title = Top level title
| header1 = {{Hộp thông tin| decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{Hộp thông tin| decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</pre>
<pre style="overflow:auto">
Lưu ý, trong các ví dụ trên, hộp thông tin con được đặt trong trường <code>data</code>, không phải trường <code>header</code>. Tiêu đề sẽ được đính kèm trong tag đậm {{tag|b}}, có thể tạo ra "hiệu ứng gấp đôi" trong một số trình duyệt nếu hộp thông tin con được đặt trong trường <code>header</code>. Để đặt hộp thông tin con vào trường tiêu đề và tránh hiệu ứng gấp đôi, hãy sử dụng
{{Hộp thông tin
| title = Top level title
| header1 = {{HộpFirst thông tin| decat = yes | child = yessubsection
{{Hộp thông tin
| title = First subsection
| child = yes
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{Hộp thông tin| decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
| header2 = Second subsection
</pre>{{clear}}
{{Hộp thông tin
 
| child = yes
or,
| label1= Label 2.1
 
| data1 = Data 2.1
{{Hộp thông tin
| title = Top level title
| header1 = First subsection
{{Hộp thông tin| decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{Hộp thông tin| decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
|belowstyle =
<pre style="overflow:auto">
|below = Below text
{{Hộp thông tin
| title = Top level title
| header1 = First subsection
{{Hộp thông tin| decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{Hộp thông tin| decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
}}
| belowstyle =
| below = Below text
}}
</pre>{{clear}}
 
Note that omitting the {{Thông số|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation.
 
=== Subboxes ===
An alternative method for embedding is to use {{Thông số|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.
 
{{Hộp thông tin
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{Hộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{Hộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| label5 = Label 5 | data5 = Data 5
| header6 = Main 6
}}
<pre style="overflow:auto">
{{Hộp thông tin
| title = Top level title
| headerstyle = background-color:#eee;
| header1 = First subsection
| labelstyle = background-color:#eee;
{{Hộp thông tin
| header1 = Main 1
| header2child = Main 2yes
| label1= Label 1.1
| data3 = {{Hộp thông tin | subbox = yes
| data1 = Data 1.1
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{Hộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| label5 = Label 5 | data5 = Data 5
| header6 = Main 6
}}
| header2 = Second subsection
</pre>{{clear}}
{{Hộp thông tin
 
| child = yes
Similar embedding technics may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
| label1= Label 2.1
 
| data1 = Data 2.1
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Hộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{Hộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| heading5 = Heading 5
}}
|belowstyle =
<pre style="overflow:auto">
|below = Below text
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Hộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
| header1 = Sub 3-1
| header2 = Sub 3-2
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{Hộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
}}
| heading5 = Heading 5
}}
</pre>{{clear}}
 
<!-- ====Tiêu đề "thủ công"====
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
Hộp thông tin có khả năng thiết kế các tiêu đề tùy chỉnh cho các thẻ chủ đề, sửa đổi một chút mã của mẫu của loại thẻ mà bạn muốn điều chỉnh. Bất kỳ loại hình ảnh nào được xử lý trong wikipedia đều có thể được sử dụng làm biểu tượng, mặc dù để duy trì tính đồng nhất với các tệp khác, bạn nên sử dụng các biểu tượng bán trong suốt, nằm trong {{commonscat|Infobox pictograms}}.
 
;Ví dụ:
=== Full blank syntax ===
(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)
 
<pre style="overflow:auto">
{{Hộp thông tin
| name italic title = {{subst:PAGENAME{italic title|}}}
| bodyclass = {{#ifeq:{{{collapsible|}}}|yes|collapsible {{{state|autocollapse}}}}} infobox vevent
| child = {{{child|}}}
| bodystyle = box-shadow:8px 8px 8px #CCC; {{#if:{{{align|}}}|float: {{{align}}};}} {{#if:{{{width|}}}|{{{width}}}}}
| subbox = {{{subbox|}}}
| aboveclass = fn
| italic title = {{{italic title|no}}}
| bodystyle labelstyle = background: #E6E6E6;
| abovestyle = background-color:#CCF;font-size:110%;font-style:italic;
 
| headerstyle = background-color: #4682b4; color: white
| titlestyle =
| abovestyle =
| subheaderstyle =
| title =
| above =
| title= {{Hộp thông tin/Định dạng đầu|t
| subheader =
|tên=''{{if empty|{{{title|}}}|{{{Title|}}}|{{PAGENAMEBASE}}}}''
 
|màu=95d3eb
| imagestyle =
|icon= Picto infobox gamepad.png
| captionstyle =
|iconsize = 55px
| image =
}}
| caption =
| image2 =
| caption2 =
 
| headerstyle =
| labelstyle =
| datastyle =
| header1 =
| label1 =
| data1 =
| header2 =
| label2 =
| data2 =
| header3 =
| label3 =
| data3 =
| header4 =
| label4 =
| data4 =
| header5 =
| label5 =
| data5 =
| header6 =
| label6 =
| data6 =
| header7 =
| label7 =
| data7 =
| header8 =
| label8 =
| data8 =
| header9 =
| label9 =
| data9 =
| header10 =
| label10 =
| data10 =
| header11 =
| label11 =
| data11 =
| header12 =
| label12 =
| data12 =
| header13 =
| label13 =
| data13 =
| header14 =
| label14 =
| data14 =
| header15 =
| label15 =
| data15 =
| header16 =
| label16 =
| data16 =
| header17 =
| label17 =
| data17 =
| header18 =
| label18 =
| data18 =
| header19 =
| label19 =
| data19 =
| header20 =
| label20 =
| data20 =
 
| belowstyle =
| below =
}}
<pre style="overflow:auto; overflow-x: scroll">
</pre>{{clear}}
 
=== Hạn chế ===
Trước đây, bản mẫu chỉ chấp nhận 120 hàng trở xuống. Hạn chế này không còn vì bản mẫu đã được chuyển đổi qua một mô đun Lua. Tuy nhiên, để tương thích với các hộp thông tin cũ, hiện có một hạn chế khoảng cách giữa các số hàng. Nếu một hàng có số 50 hơn hàng dẫn trước, bản mẫu này có thể bỏ qua các hàng dẫn sau (tùy các số). Nếu một hàng có số 100 hơn hàng dẫn trước, các hàng dẫn sau chắc chắn sẽ được bỏ qua.
 
Thí dụ hộp thông tin này sẽ hiển thị đầy đủ:
 
{{Hộp thông tin
| italic title = {{{italic title|}}}
| header3 = Phần 1
| bodyclass = {{#ifeq:{{{collapsible|}}}|yes|collapsible {{{state|autocollapse}}}}} infobox vevent
| label48 = Nhãn A
| bodystyle = box-shadow:8px 8px 8px #CCC; {{#if:{{{align|}}}|float: {{{align}}};}} {{#if:{{{width|}}}|{{{width}}}}}
| data48 = Dữ liệu A
| aboveclass data92 = Data= Bfn
| labelstyle = background: #E6E6E6;
| label136 = Nhãn C
| abovestyle = background-color:#CCF;font-size:110%;font-style:italic;
| data136 = Dữ liệu C
| headerstyle = background-color: #4682b4; color: white
| header177 = Phần 2
| above =
| label215 = Nhãn D
| title= {{Hộp thông tin/Định dạng đầu|t
| data215 = Dữ liệu D
|tên=''{{if empty|{{{title|}}}|{{{Title|}}}|{{PAGENAMEBASE}}}}''
|màu=95d3eb
|icon= Picto infobox gamepad.png
|iconsize = 55px
}}
}}
</pre> -->
<div style="overflow:auto">
<nowiki>{{</nowiki>Hộp thông tin
| header<b style="color:black;background:#AFA">3</b> = Phần 1
| label<b style="color:black;background:#AFA">48</b> = Nhãn A
| data<b style="color:black;background:#AFA">48</b> = Dữ liệu A
| data<b style="color:black;background:#AFA">92</b> = Dữ liệu B
| label<b style="color:black;background:#AFA">136</b> = Nhãn C
| data<b style="color:black;background:#AFA">136</b> = Dữ liệu C
| header<b style="color:black;background:#AFA">177</b> = Phần 2
| label<b style="color:black;background:#AFA">215</b> = Nhãn D
| data<b style="color:black;background:#AFA">215</b> = Dữ liệu D
<nowiki>}}</nowiki>
</div>{{clear}}
 
==Tham số đầy đủ==
Hộp thông tin này chỉ hiển thị Phần 1, Nhãn A, và Dữ liệu A, vì Dữ liệu B có số quá lớn so với Dữ liệu A; tất cả các tham số dẫn sau sẽ được bỏ qua:
(Lưu ý: bản mẫu hiện xử lý và hiển thị không giới hạn số hàng; chỉ có 20 được đưa ra dưới đây vì hộp thông tin lớn hơn sẽ tương đối hiếm. Chỉ cần mở rộng đánh số khi cần thiết. Các tham số "class" microformat cũng bị bỏ qua vì chúng không được sử dụng phổ biến.)
 
<pre style="overflow:auto;">
{{Hộp thông tin
|name = {{subst:PAGENAME}}
| header3 = Phần 1
|bodystyle label48 = Nhãn A
|title data48 = Dữ liệu A=
|titlestyle =
| data102 = Dữ liệu B
|above =
| label103 = Nhãn C
|abovestyle =
| data103 = Dữ liệu C
| header115 = Phần 2
| label120 = Nhãn D
| data120 = Dữ liệu D
}}
<div style="overflow:auto">
<nowiki>{{</nowiki>Hộp thông tin
| header<b style="color:black;background:#AFA">3</b> = Phần 1
| label<b style="color:black;background:#AFA">48</b> = Nhãn A
| data<b style="color:black;background:#AFA">48</b> = Dữ liệu A
| data<b style="color:black;background:#FAA">102</b> = Dữ liệu B
| label<b style="color:black;background:#AFA">103</b> = Nhãn C
| data<b style="color:black;background:#AFA">103</b> = Dữ liệu C
| header<b style="color:black;background:#AFA">115</b> = Phần 2
| label<b style="color:black;background:#AFA">120</b> = Nhãn D
| data<b style="color:black;background:#AFA">120</b> = Dữ liệu D
<nowiki>}}</nowiki>
</div>{{clear}}
 
|imagestyle =
Lưu ý rằng các tham số có thể được để trống. Các hàng đều được tính vào hạn chế này miễn là có '''header(''n'')''' hoặc '''data(''n'')''' trong đoạn mã gọi bản mẫu:
|captionstyle =
 
|image =
{{Hộp thông tin
|caption header3 = Phần 1=
|image2 label48 = Nhãn A =
|caption2 data48 = Dữ liệu A
| data70 =
| data102 = Dữ liệu B
| label103 = Nhãn C
| data103 = Dữ liệu C
| header115 = Phần 2
| label120 = Nhãn D
| data120 = Dữ liệu D
}}
<div style="overflow:auto">
<nowiki>{{</nowiki>Hộp thông tin
| header<b style="color:black;background:#AFA">3</b> = Phần 1
| label<b style="color:black;background:#AFA">48</b> = Nhãn A
| data<b style="color:black;background:#AFA">48</b> = Dữ liệu A
| data<b style="color:black;background:#AFA">70</b> =
| data<b style="color:black;background:#AFA">102</b> = Dữ liệu B
| label<b style="color:black;background:#AFA">103</b> = Nhãn C
| data<b style="color:black;background:#AFA">103</b> = Dữ liệu C
| header<b style="color:black;background:#AFA">115</b> = Phần 2
| label<b style="color:black;background:#AFA">120</b> = Nhãn D
| data<b style="color:black;background:#AFA">120</b> = Dữ liệu D
<nowiki>}}</nowiki>
</div>{{clear}}
 
|headerstyle =
Nếu chỉ có '''label(''n'')''' được định rõ (có thể có giá trị) mà không có '''header(''n'')''' hoặc '''data(''n'')''', tham số được bỏ qua giống như thể nó không được định rõ:
|labelstyle =
|datastyle =
 
|header1 =
{{Hộp thông tin
| header3label1 = Phần 1
|data1 label48 = Nhãn A
|header2 =
| data48 = Dữ liệu A
|label2 =
| label70 = Nhãn giả
|data2 data102 = Dữ liệu B
|header3 =
| label103 = Nhãn C
|label3 =
| data103 = Dữ liệu C
|data3 =
| header115 = Phần 2
|header4 =
| label120 = Nhãn D
|label4 =
| data120 = Dữ liệu D
|data4 =
}}
|header5 =
<div style="overflow:auto">
|label5 =
<nowiki>{{</nowiki>Hộp thông tin
|data5 =
| header<b style="color:black;background:#AFA">3</b> = Phần 1
|header6 =
| label<b style="color:black;background:#AFA">48</b> = Nhãn A
|label6 =
| data<b style="color:black;background:#AFA">48</b> = Dữ liệu A
|data6 =
| <b style="color:black;background:#FAA">label70</b> = Nhãn giả
|header7 =
| data<b style="color:black;background:#AFA">102</b> = Dữ liệu B
|label7 =
| label<b style="color:black;background:#AFA">103</b> = Nhãn C
|data7 =
| data<b style="color:black;background:#AFA">103</b> = Dữ liệu C
|header8 =
| header<b style="color:black;background:#AFA">115</b> = Phần 2
|label8 =
| label<b style="color:black;background:#AFA">120</b> = Nhãn D
|data8 =
| data<b style="color:black;background:#AFA">120</b> = Dữ liệu D
|header9 =
<nowiki>}}</nowiki>
|label9 =
</div>{{clear}}
|data9 =
|header10 =
|label10 =
|data10 =
|header11 =
|label11 =
|data11 =
|header12 =
|label12 =
|data12 =
|header13 =
|label13 =
|data13 =
|header14 =
|label14 =
|data14 =
|header15 =
|label15 =
|data15 =
|header16 =
|label16 =
|data16 =
|header17 =
|label17 =
|data17 =
|header18 =
|label18 =
|data18 =
|header19 =
|label19 =
|data19 =
|header20 =
|label20 =
|data20 =
 
|headern = (n là số hàng sau 20 nếu cần thiết)
Các tham số '''image(''n'')''' và '''subheader(''n'')''' có hạn chế tương tự: các tham số này phải không cách nhau hơn 10 hàng.
|labeln =
|datan =
 
|belowstyle =
=== Porting to other MediaWikis ===
|below =
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] extension and [[mw:Manual:Using content from Wikipedia#HTMLTidy|HTMLTidy]] to be installed. It may not work with other MediaWikis. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.
}}</pre>
 
===Xem See also =thêm==
*{{tl|start infobox page}}
* [[Module:Infobox]] - the [[WP:LUA|Lua]] module on which this template is based
*{{tl|infobox3cols}}
* [[Template:Infobox/old]] - the old ParserFunctions implementation
* {{tl|infobox3cols}}
* {{tl|Navbox}}
* [[Wikipedia:List of infoboxes|List of infoboxes]]
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
[[Thể loại:Bản mẫu hộp thông tin| ]]
[[Thể loại:Siêu bản mẫu Wikipedia|{{PAGENAME}}]]
}}</includeonly>