![警告](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/Ambox_warning_orange.svg/40px-Ambox_warning_orange.svg.png) | 此模板被引用於約726,000個頁面,佔全部頁面的9%。 為了避免造成大規模的影響,所有對此模板的編輯應先於沙盒、測試樣例或您的沙盒上測試。 測試後無誤的版本可以一次性地加入此模板中,但是修改前請務必於討論頁發起討論。
模板引用數量會自動更新。 |
用法
基本
{{Portal |Portal 1 |Portal 2 |Portal 3 |... }}
所有參數
{{Portal
| Portal 1
| Portal 2
| Portal 3
| ...
| left = <!-- yes -->
| margin = <!-- CSS margin -->
| break = <!-- yes -->
| boxsize = <!-- custom box width in pixels -->
| image1 = <!-- image override for Portal 1 -->
}}
兼容模式
中文維基百科舊portal模板的參數格式與Lua版本的多參數模式不盡相同。為保證兼容性,Lua模板中也增加了對這兩種形式的支持。
name image
如果沒有指定位置參數,則嘗試將:
{{Portal|name=Portal 1|image=Image 1.png <!-- 可选 -->}}
解讀為:
{{Portal|1=Portal 1|image1=Image 1.png <!-- 可选 -->}}
這一步驟並不會讓模板運算變得十分複雜,因此基本無需修正到新格式。
2號位作圖像
如果參數數量為2,且第二項按照文件名理解時擴展名長度為3或4,則嘗試將:
{{Portal|Portal 1|Image 1.xyz}}
解讀為:
{{Portal|1=Portal 1|image1=Image 1.xyz}}
為減少誤報,模塊會在擴展名不是常用圖片格式(png、jpg、svg)時檢查文件是否存在。檢查步驟為「昂貴操作」,對服務器負擔較重,因此請檢查文檔底部的追蹤分類進行清理。
位置
在條目裡面,本模板通常放置在條目底端的「參見」章節。
舉例
Code |
Result
|
{{Portal|科学}}
|
|
{{Portal|1=科学|2=弹维基|image2=New-Bouncywikilogo.gif|3=默认图片}}
|
|
TemplateData
TemplateData
|
模板參數[編輯模板資料] 參數 | 描述 | 類型 | 狀態 |
---|
Portal (1) | 1 | Inserts the portal image and text. Further portals can be added to the template by increasing the number
| 字串 | 必填 |
---|
Portal (2) | 2 | Insert the portal image and text
| 字串 | 非必填 |
---|
Portal (3) | 3 | Insert the portal image and text
| 字串 | 非必填 |
---|
Side | left | If set to yes, the portal appears on the left side of the page instead of the right. - 預設
- no
| 字串 | 非必填 |
---|
Margin size | margin | Alters the margin size. Any valid CSS margin is accepted
| 數值 | 非必填 |
---|
Line break | break | If set to yes, a line break is inserted after the portal name and before the word portal
| 字串 | 非必填 |
---|
Box size | boxsize | This sets a custom box width in pixels.
| 數值 | 非必填 |
---|
|
圖片
自動配圖模塊(取代Template:Portal/Images,請檢查圖像數據是否遷移完畢):
參見
- {{Portals}},該模板提供現有主題的一個列表。
- {{Portal bar}},該模板可一次性添加數個主題鏈接,並橫向顯示。
- {{Portal-inline}},該模板可添加一個不帶邊框的主題鏈接。
- 排錯分類:
重定向