Bản mẫu:Hộp thông báo
Tài liệu bản mẫu[xem] [sửa] [sử] [xóa]

Bản mẫu:Template doc page transcluded Bản mẫu:Sử dụng nhiều Bản mẫu:Lua

Bản mẫu:Mbox templates (small) Đây là siêu bản mẫu {{Ambox}} ([A]rticle [m]essage [box]), còn gọi là hộp thông báo.

Nó được sử dụng để tạo ra các bản mẫu hộp thông báo bài viết, như {{Underlinked}}. Nó cung cấp một số màu khác nhau, sử dụng hình ảnh mặc định nếu không có tham số hình ảnh nào được đưa ra và có một số tính năng khác.

Các tham số phổ biến[sửa]

Hộp bên dưới hiển thị các tham số phổ biến nhất được chấp nhận bởi {{Ambox}}. Mục đích của mỗi được mô tả dưới đây. Các tham số này là tham số tiếng Anh, các tham số tiếng Việt sẽ được ghi bên cạnh trong thông tin hướng dẫn từng tham số chi tiết bên dưới.

{{hộp thông báo
| name  = 
| subst = <includeonly>{{subst:substcheck}}</includeonly>
| small = {{{small|}}}
| type  = 
| image = 
| sect  = {{{1|}}}
| issue = 
| talk  = {{{talk|}}}
| fix   = 
| date  = {{{date|}}}
| cat   = 
| all   = 
}}

name / tên[sửa]

Tham số name / tên chỉ định tên của bản mẫu, không có tiền tố không gian tên mẫu. Ví dụ: {{Underlinked}} chỉ định |name=Underlinked.

Tham số này cần được cập nhật nếu bản mẫu được di chuyển. Mục đích của tham số này là gấp đôi:

  • Nếu không thay thế chính xác, nó cho phép bản mẫu meta thông báo tên của bản mẫu đã được thay thế, có thể giúp người chỉnh sửa khắc phục sự cố.
  • Nó cho phép mẫu có một màn hình hữu ích hơn trên trang bản mẫu của nó, ví dụ để hiển thị ngày ngay cả khi không được chỉ định và áp dụng phân loại mẫu của chính nó.

subst / thế[sửa]

Tham số subst / thế cho phép bản mẫu meta phát hiện xem bản mẫu có bị thay thế không chính xác hay không và đưa ra cảnh báo thích hợp. Nó cũng sẽ thêm các trang như vậy vào Thể loại:Trang nhúng bản mẫu một cách không chính xác. Chỉ cần sao chép mã chính xác như nó xuất hiện trong hộp.

small / nhỏ[sửa]

Tham số small / nhỏ phải được chuyển qua bản mẫu, vì điều này sẽ cho phép các biên tập viên sử dụng định dạng nhỏ bằng cách chỉ định |small=left trên một bài viết:

Nếu không, định dạng chuẩn sẽ được tạo ra:

Các biến thể khác:

  • Đối với các bản mẫu không bao giờ phải nhỏ, chỉ định |small=no (có thể thay no bằng không) hoặc không vượt qua tham số nhỏ nào cả.
  • Đối với các bản mẫu luôn luôn phải nhỏ, chỉ định |small=left.
  • Đối với các bản mẫu nên 'mặc định là nhỏ' ', hãy thử |small={{{small|left}}} hoặc |small={{{small|trái}}}. Điều này sẽ cho phép một trình soạn thảo ghi đè bằng cách sử dụng |small=no (có thể thay no bằng không) trên bài viết

Xem Bản mẫu:Sectionlink, bên dưới, để biết thông tin về cách giới hạn hiển thị |small= trong các trường hợp khi mẫu đang được sử dụng cho một phần thay vì toàn bộ bài viết (được khuyến nghị, để ngăn hiển thị đầu bài không nhất quán).

type / loại[sửa]

Tham số type / loại tham số xác định màu của thanh bên trái và hình ảnh được sử dụng theo mặc định. Loại được chọn không dựa trên tính thẩm mỹ mà dựa trên loại vấn đề mà bản mẫu mô tả. Bảy loại có sẵn và hình ảnh mặc định của chúng được hiển thị dưới đây.

Tham số tiếng Anh
Tham số tiếng Việt

Nếu không có tham số type / loại được chỉ ra thì mặc định của bản mẫu là |type=notice.

image / hình[sửa]

Bạn có thể chọn một hình ảnh cụ thể để sử dụng cho mẫu bằng cách sử dụng tham số image/hình. Hình ảnh được chỉ định bằng cú pháp tiêu chuẩn để chèn tập tin trong Wikipedia (see en:Wikipedia:Manual of Style/Images#How to place an image.) Chiều rộng 40-50px là điển hình. Ví dụ:

  • {{POV}} chỉ định |image=[[Tập tin:Unbalanced scales.svg|40px|link=|alt=]] và trông như thế này:

Bản mẫu:POV

  • {{underlinked}} chỉ định |image=[[Tập tin:Ambox wikify.svg|50x40px|link=|alt=]] và trông như thế này:

Bản mẫu:Underlinked

Xin lưu ý

  • Nếu không có tham số hình thì bản mẫu sử dụng hình ảnh mặc định. Hình ảnh mặc định nào được dùng phụ thuộc vào tham số type/loại được sử dụng (Xem #type / loại bên trên.)
  • If |image=none (có thể thay none thành không) được chỉ định, sẽ không có hình ảnh nào được sử dụng và văn bản được hiển thị toàn bộ khu vực hộp thông báo.
  • Nếu biểu trưng là hoàn toàn trang trí và cũng trong phạm vi công cộng, khả năng truy cập có thể được cải thiện bằng cách chặn liên kết đến trang tệp bằng cách thêm "|link=|alt=" giống như bên trên.

sect[sửa]

Nhiều bản mẫu thống báo bài viết bắt đầu bằng văn bản Bài viết này ... và điều thường được mong muốn là từ ngữ này thay đổi thành Phần này ... nếu bản mẫu được sử dụng trên một phần thay thế. Giá trị của tham số này sẽ thay thế từ "bài viết". Các khả năng khác nhau để sử dụng bao gồm: |sect=list, |sect=table, |sect="In popular culture" material, etc.

Nếu sử dụng tính năng này, hãy nhớ xóa hai từ đầu tiên ("Bài viết này") khỏi văn bản của bản mẫu, nếu không nó sẽ bị trùng lặp.

Một cách phổ biến để tạo điều kiện cho chức năng này là dùng |sect={{{1|}}}. Điều này sẽ cho phép các biên tập viên gõ tùy chỉnh tham số section, ví dụ, là tham số chưa được đặt tên đầu tiên của bản mẫu để thay đổi từ ngữ. Ví dụ, {{Advert|section}} sẽ ra: Bản mẫu:Advert Một cách tiếp cận khác là dùng |sect={{{section|{{{sect|}}}}}} để cung cấp một giá trị được đặt tên. Một cách khác là sử dụng {{Yesno}} phân tích giá trị cho dương và vượt qua |sect=section nếu đúng.

Những cách tiếp cận này có thể được kết hợp và điều này được khuyến khích. Mã sẵn sàng sau đây: Bản mẫu:Block indent cho phép như sau:

  • Any positive value that {{Yesno}} can detect will be used with the named parameter in the ambox-based template to get "section" instead of "article": |section=y, |sect=True, etc. It is recommended to allow both |sect= and |section= so that editors do not have to guess which one will work. The sample code above does this for you.
  • Any other value passed, in any manner, will replace "article": |section and its subsections, |1=list, |sect=section, |section=table, etc.

It is also advisable to restrict use of the |small= parameter so that it is made contingent upon the template being applied to a section (or whatever) rather than the whole article, to prevent the small version of the template being used at the top of the article where it would be inconsistent with other article-wide cleanup/dispute banners: Bản mẫu:Block indent (In this case, any value of |small= or |left= will trigger the small, left display, as long as some value of |sect= or one of its aliases in that template has also been provided.) This code can be copy-pasted and used with the above code block. See, e.g., Template:Trivia and its Template:Trivia/testcases to observe the combined functionality.

issue and fix[sửa]

The issue parameter is used to describe the issue with the article. Try to keep it short and to-the-point (approximately 10-20 words) and be sure to include a link to a relevant policy or guideline.

The fix parameter contains some text which describes what should be done to improve the article. It may be longer than the text in issue, but should not usually be more than two sentences.

When the template is in its compact form (when placed inside {{multiple issues}}) or small form (when using |small=left), the issue is the only text that will be displayed. For example, {{POV}} defines

  • |issue=This article '''has an unclear citation style'''.
  • |fix=The references used may be made clearer with a different or consistent style of [[Wikipedia:Citing sources|citation]], [[Wikipedia:Footnotes|footnoting]], or [[Wikipedia:External links|external linking]].

When used stand-alone it produces the whole text: Bản mẫu:Citation style

But when used inside {{Nhiều vấn đề}} or with |small=left it displays only the issue: Bản mẫu:Nhiều vấn đề Bản mẫu:POV

talk[sửa]

Some article message templates include a link to the talk page, and allow an editor to specify a section heading to link directly to the relevant section. To achieve this functionality, simply pass the talk parameter through, i.e. |talk={{{talk|}}}

This parameter may then be used by an editor as follows:

  • |talk=SECTION HEADING – the link will point to the specified section on the article's talk page, e.g. |talk=Foo
  • |talk=FULL PAGE NAME – the template will link to the page specified (which may include a section anchor), e.g. |talk=Talk:Banana#Foo

Notes:

  • When this parameter is used by a template, the talk page link will appear on the template itself (in order to demonstrate the functionality) but this will only display on articles if the parameter is actually defined.
  • In order to make sure there is always a link to the talk page, you can use |talk={{{talk|#}}}.
  • If the talk page does not exist, there will be no link, whatever the value of the parameter.

date[sửa]

Passing the date parameter through to the meta-template means that the date that the article is tagged may be specified by an editor (or more commonly a bot). This will be displayed after the message in a smaller font.

Passing this parameter also enables monthly cleanup categorisation when the cat parameter is also defined.

info[sửa]

This parameter is for specifying additional information. Whatever you add here will appear after the date, and will not be displayed if the template is being wrapped in {{multiple issues}}.

removalnotice[sửa]

If you specify |removalnotice=yes, then the following notice will be displayed after the date and after the info text:

This will not be displayed if the template is being wrapped in {{multiple issues}}.

cat[sửa]

This parameter defines a monthly cleanup category. If |cat=CATEGORY then:

  • articles will be placed in Category:CATEGORY from DATE if |date=DATE is specified.
  • articles will be placed in Category:CATEGORY if the date is not specified.

For example, {{No footnotes}} specifies |cat=Articles lacking in-text citations and so an article with the template {{No footnotes|date=June 2010}} will be placed in Category:Articles lacking in-text citations from June 2010.

The cat parameter should not be linked, nor should the prefix Category: be used.

all[sửa]

The all parameter defines a category into which all articles should be placed.

The all parameter should not be linked, nor should the prefix Category: be used.

Other parameters[sửa]

The "All parameters" box shows all possible parameters for this template. However, it is not recommended to copy this, because it will never be required to use all parameters simultaneously.

All parameters
{{Ambox
| name        = 
| subst       = <includeonly>{{subst:substcheck}}</includeonly>
| small       = {{{small|}}}
| type        = 
| image       = 
| imageright  = 
| smallimage  = 
| smallimageright = 
| class       = 
| style       = 
| textstyle   = 
| sect        = {{{1|}}}
| issue       = 
| talk        = {{{talk|}}}
| fix         = 
| date        = {{{date|}}}
| text        = 
| smalltext   = 
| plainlinks  = no
| removalnotice =
| cat         = 
| all         = 
| cat2        = 
| all2        = 
| cat3        = 
| all3        = 
}}<noinclude>
{{Documentation}}
</noinclude>

imageright[sửa]

An image on the right side of the message box may be specified using this parameter. The syntax is the same as for the image parameter, except that the default is no image.

smallimage and smallimageright[sửa]

Images for the small format box may be specified using these parameters. They will have no effect unless |small=left is specified.

class[sửa]

Custom CSS classes to apply to the box. If adding multiple classes, they should be space-separated.

style and textstyle[sửa]

Optional CSS values may be defined, without quotation marks " " but with the ending semicolons ;.

  • style specifies the style used by the entire message box table.
  • textstyle relates to the text cell.

text and smalltext[sửa]

Instead of specifying the issue and the fix it is possible to use the text parameter instead.

Customised text for the small format can be defined using smalltext.

plainlinks[sửa]

Normally on Wikipedia, external links have an arrow icon next to them, like this: Example.com. However, in message boxes, the arrow icon is suppressed by default, like this: Example.com. To get the normal style of external link with the arrow icon, use |plainlinks=no.

cat2, cat3, all2, and all3[sửa]

  • cat2 and cat3 provide for additional monthly categories; see #cat.
  • all2 and all3 provide for additional categories into which all articles are placed, just like #all.

Ghi chú kỹ thuật[sửa]

  • Siêu bản mẫu này chỉ là lớp bao bọc mỏng cho các lớp ambox CSS trong MediaWiki:Common.css. Các lớp cũng có thể được sử dụng trực tiếp trong một wikitable nếu chức năng đặc biệt là cần thiết. Xem how-to guide cho điều đó.
  • Nếu bạn cần thiết phải dùng các ký tự đặc biệt trong tham biến chữ thì bạn phải dùng ký tự đánh dấu thoát như sau:
{{hộp thông báo
| chữ  = <div>
Dấu bằng = và dấu ngoặc móc đóng và mở { } hoạt động bình thường.
Nhưng ở đây dấu suyệt đứng {{!}} và dấu móc kép <nowiki>}}</nowiki>. 
Và giờ là dấu suyệt đứng và các dấu móc đóng <nowiki>|}}</nowiki>.
</div>
}}
  • The <div> tags that surround the text in the example above are usually not needed. But if the text contains line breaks then sometimes we get weird line spacing. This especially happens when using vertical dotted lists. Then use the div tags to fix that.
  • This template uses CSS classes in MediaWiki:Common.css for most of its looks, thus it is fully skinnable.
  • This template calls Module:Message box which holds most of the code for {{Ambox}}, while {{Ambox}} itself does parameter preprocessing.
  • Internally, this meta-template uses HTML markup instead of wikimarkup for the table code. That is the usual way meta-templates are made, since wikimarkup has several drawbacks. For instance, it makes it harder to use parser functions and some special characters in parameters.
  • The default images for this meta-template are in png format instead of svg format. The main reason is that some older web browsers have trouble with the transparent background that MediaWiki renders for svg images. The png images here have hand optimised transparent background colour so they look good in all browsers. Note that svg icons only look somewhat bad in the old browsers, thus such hand optimisation is only worth the trouble for very widely used icons.
  • For more technical details see the talk page and the "See also" links below. Since this template works almost exactly like {{Tmbox}}, {{Imbox}}, {{Cmbox}} and {{Ombox}} their talk pages and related pages might also contain more details.

See also[sửa]

Bản mẫu:Mbox templates see also Other pages: