Editing
MediaWiki Template
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[MediaWikiInstallRecord |MediaWiki]] 模版用法 * 使內容與樣式分開 * 重複使用內容只需要編輯一處 解釋 * 語法區塊: noinclude語法區塊,是指包含noclude語法及<nowiki><noinclude> 及 </noinclude></nowiki> 區塊內的內容。 * 嵌入: 頁面B嵌入頁面A內容。ex: (頁B)「[[Multimedia Online Helpdesk Software|建立多媒體說明文件的軟體]]」嵌入了(頁A)「[[Screen Capture|畫面擷取]]」的內容。 {{Tip | tip=如何嵌入其他頁面內容: 如果在頁面B嵌入頁面A內容,那麼編輯頁面B時,輸入 <nowiki>{{:頁面A頁面名稱}}</nowiki> }} == Noinclude, includeonly, and onlyinclude比較表 == <table width="" border="1"> <tr> <th rowspan="2" scope="col">語法區塊</th> <th colspan="2" scope="col">語法區塊(模板)所在的 頁面A</th> <th colspan="2" scope="col">閱讀(嵌入頁面A的)頁面B時,是否顯示</th> </tr> <tr> <td><strong>編輯頁面A</strong>時,是否顯示區塊內容</td> <td><strong>閱讀頁面A</strong>時,是否顯示區塊內容</td> <td>語法區塊<strong>內</strong>的內容</td> <td>語法區塊<strong>外</strong>的內容</td> </tr> <tr> <th scope="row">Noinclude</th> <td>顯示</td> <td>顯示</td> <td><span style="color:grey;">不顯示</span></td> <td>顯示</td> </tr> <tr> <th scope="row">includeonly </th> <td>顯示</td> <td><span style="color:grey;">不顯示</span></td> <td>顯示</td> <td>顯示</td> </tr> <tr> <th scope="row">onlyinclude</th> <td>顯示</td> <td>顯示</td> <td>顯示</td> <td><span style="color:grey;">不顯示</span></td> </tr> </table> == Noinclude, includeonly, and onlyinclude == ;Noinclude 在(頁面A) <nowiki><noinclude> 及 </noinclude></nowiki> 區塊內的任何內容,'''不嵌入'''到頁面B。區塊外內容,則會嵌入。 * 應用: ** 我在頁A放了連結,可以連回頁B。但是我不想要嵌入頁A內容的頁B內,還會看到「連回頁B」。因此頁A的「連回頁B」的連結,需要放到noinclude語法區塊內。 ** 針對模版用法的解釋說明,可放到noinclude語法區塊內 ex: Wikipedia[http://zh.wikipedia.org/wiki/Template:Stub_Category 小作品模版]。 ;includeonly 在(頁面A) <nowiki><includeonly> 及 </includeonly></nowiki> 區塊內及區塊外的任何內容,一起'''嵌入'''到頁面B。 * 應用: [http://index.wikia.com/wiki/%E7%B4%80%E9%8C%84%E7%89%87%E5%85%AC%E5%9C%92 紀錄片公園]的授權資訊(類別:Cc-by-nc-nd)是經由[http://index.wikia.com/wiki/%E6%A8%A1%E6%9D%BF:Cc-by-nc-nd 模板:Cc-by-nc-nd]嵌入。但是「模板:Cc-by-nc-nd」不應該被分類到「類別:Cc-by-nc-nd」,所以類別部分應該放到includeonly區塊內。 ;onlyinclude 在(頁面A) <nowiki><onlyinclude> 及 </onlyinclude></nowiki> 區塊內的任何內容,'''嵌入'''到頁面B。區塊外則不嵌入。如果頁面A同時有onlyinclude及includeonly兩種語法區塊,也僅會嵌入onlyinclude區塊。 * 應用: ** 頁面B放頁面A的簡介及連結,那麼可以把頁面A的簡介文字放到頁面A內的onlyinclude區塊。 ** 母頁面B([[File Convert|ex]])要嵌入頁面A1([[Document converter|ex]]), A2([[Image converter|ex]])等子頁面的內容,而子頁面又要連回頁面B。子頁面的主要內容可放到onlyinclude區塊。 ---- 相關資料 * [http://meta.wikimedia.org/wiki/Help:Template Help:Template - Meta] * [http://zh.wikipedia.org/wiki/Help:%E5%8F%98%E9%87%8F Help:變數 - Wikipedia] * [http://zh.wikipedia.org/w/index.php?title=Wikipedia:%E5%AF%BC%E8%88%AA%E6%A8%A1%E6%9D%BF&variant=zh-tw Wikipedia:導航模板] * [http://en.wikipedia.org/wiki/Wikipedia:Transclusion Wikipedia:Transclusion] [[Category:MediaWiki]] [[Category:Templates]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Template:Tip
(
view source
) (semi-protected)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information