美国主机Lunarpages

Mediawiki中文技术论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12589|回复: 0

Mediawiki的模板(一)

[复制链接]
发表于 2012-1-12 10:27:28 | 显示全部楼层 |阅读模式
RAKsmart美国服务器
参考自MediaWiki Handbook:http://meta.wikimedia.org/wiki/Help:Template#Parameters
The template namespace is the namespace with prefix "Template:".
模板的名空间以“Template“为前缀.

A page in this namespace is called a template. The contents of such a page (either fixed or depending on parameters and/or variables) is designed to be useful for insertion in other pages (transclusion, creating a compound document).

The syntax for insertion of the page "Template:name" is {{name}}. This is called a template tag.

插入模板的标记是{{name}} “Template:name“
This reference in the wikitext causes insertion of the template content when the referring page is rendered. Various equivalent terms are:

calling the template 调用模板
referring to the template 涉及模板
including the template 包含模板
If the page "Template:name" does not exist, then {{name}} works as [[Template:name]], a link to a non-existing page, leading to the edit page. Thus, one way of making a template is putting the tag first, and then following the link.

如果”Template:name”不存在,那么{{name}}则链接到一个不存在的页面,可供编辑,这也是建立模板的一个方法.


If name starts with a valid namespace prefix, or a colon, then it is not prefixed with "Template:". This way any page can be used as template (a colon at the start refers to the main namespace). In the case of an image or category, it gives the description part. Using a page outside the template namespace as template can be useful for:

如果name以其他有效的名空间为前缀,这样任何的页面可以用作模板.在模板名空间外使用页面有时候很有用:

quoting interface messages in the MediaWiki namespace 提供mediawiki名空间消息接口
experimenting with templates in subpages of one's userpage 在用户子页面测试模板,“沙盒“
using the description of an image for a caption 把一个图片的描述用作标题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

美国主机评测网站

Archiver|手机版|小黑屋|Mediawiki中文技术论坛

GMT+8, 2024-11-24 16:12 , Processed in 0.048111 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表