跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
沙盒
编辑指导
用户守则
编写指导
社群首页
服务器索引
推荐服务器
知名服务器
服务器分类
基岩版服务器
Java版服务器
服务端教程
友情链接
MCBBS Wiki
像素科技
关于
站长主页
交流群
QQ频道
MCServerWiki
搜索
搜索
外观
创建账号
登录
个人工具
创建账号
登录
未登录编辑者的页面
了解详情
贡献
讨论
欢迎来到MCServerWiki!如果您是第一次来到这里,请点击:
创建账户
编辑“︁
帮助:横幅
”︁
帮助
讨论
大陆简体
阅读
编辑源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
编辑源代码
查看历史
常规
链入页面
相关更改
页面信息
导航
特殊页面
外观
移至侧栏
隐藏
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
== 用法 == 有几种不同的方法可以在页面上设置横幅图像: 要<code>File:Image_name.jpg</code>用作自定义横幅图像,请将其设置在页面上:<nowiki>{{PAGEBANNER:Image_name.jpg}}</nowiki> 该扩展可以自动将相同的横幅图像添加到指定命名空间的所有页面,通过设置 $wgWPBImage 如果维基连接到维基数据,它还可以从那里获取每个页面的横幅。 === Required Template === </translate> <translate><!--T:11--> Template:PAGEBANNER must exist.</translate> <translate><!--T:12--> It can be empty.</translate> <translate><!--T:13--> Wikivoyage has an example of a [[voy:Template:Pagebanner|complex Template:PAGEBANNER]] with rendering logic and additional template dependencies.</translate> <translate> ==Parameters to the <tvar name=1><nowiki>{{PAGEBANNER}}</nowiki></tvar> function== <!--T:14--> <!--T:15--> The following parameters are supported to the <tvar name=1><code><nowiki>{{PAGEBANNER}}</nowiki></code></tvar> parser function: </translate> * <code>pgname</code> — <translate><!--T:16--> Adds a custom title to the banner.</translate> * <code>icon-*</code> — To add custom icons, add the parameter <code>icon-<icon_name>=<Article about icon></code> (where <code><icon_name></code> is any icon name that you want). Then define a background-image on <code>.oo-ui-icon-<icon_name></code>, in MediaWiki:Common.css to use as the icon. Do this for any number of icons to add to the page. * <code>tooltip</code> — Use <code>tooltip=image-caption</code> to show image description on hovering over image. * <code>toc</code> — Use <code>toc=yes</code> to enable a Table Of Contents within banner. * <code>bottomtoc</code> — Use <code>bottomtoc=yes</code> to push Table Of Contents below banner. This will affect only the page on which its used. To set site-wide ToC at bottom, see [[#Styling]] below. * <code>extraClass</code> — Use <code>extraClass=<css-class names></code> (separated by spaces) to add additional classes to banners which can be used to customize it using styles in MediaWiki:Common.css * <code>origin</code> — See [[#origin]] parameter below. * <code>link</code> — Sets the target of the banner link and operates the same as the [[Help:Images#Altering_the_default_link_target|link parameter]] for images (e.g. <code>link=Event name</code> will link to the 'Event name' page rather than the banner image page). Set to no value to remove the link, i.e. <code>link=</code>. {{anchor|origin}} <translate> === <tvar name=1>'origin'</tvar> parameter === <!--T:17--> </translate> [[File:WikidataPageBanner coordinates, landscape.svg|thumb|Banner coordinate system.]] <translate><!--T:18--> Use this parameter to define a suggested focal area of the image.</translate> <translate><!--T:19--> This is used to crop the banner appropriately on small screens.</translate> <translate><!--T:20--> The value of the parameter should consist of an X and a Y coordinate separated by a comma.</translate> <translate><!--T:21--> Each coordinate represents the distance from the center of the image as a value from -1 to 1.</translate> <translate><!--T:22--> For example, <tvar name=1><code>origin=1,1</code></tvar> is the top right corner and <tvar name=2><code>origin=-1,1</code></tvar> is the bottom right corner.</translate> <translate><!--T:39--> See the image at right for a graphical representation of the coordinates.</translate> <translate><!--T:24--> Note, as currently implemented, the origin parameter is meant for images that are much larger than the target banner (e.g. panoramas or portrait photos).</translate> <translate><!--T:25--> It will not reposition banners where the repositioning leads to empty whitespace within the banner space.</translate> <translate><!--T:26--> For example, if the banner is being rendered at 320px width and 180px height, an image that is also 320px and 180px cannot be repositioned at all; an image that is 600px width by 180px height can be repositioned horizontally and an image that is 320px width and 1000px height can be repositioned vertically.</translate> {{anchor|config}} <translate> ==Configuration variables == <!--T:27--> </translate> <translate><!--T:29--> <tvar name=1>'''$wgWPBImage'''</tvar> is used to set the default banner image to be used.</translate> <translate><!--T:30--> Add image name without prefixing 'File:' namespace.</translate> <translate><!--T:31--> If the wiki does not need default banners, do not edit this field.</translate> <syntaxhighlight lang="php"> $wgWPBImage = "foo.jpg"; </syntaxhighlight> '''$wgWPBBannerProperty''' Banner property on Wikidata which holds a commons media file. Essential if Wikidata is enabled. <syntaxhighlight lang="php"> $wgWPBBannerProperty = "P948"; </syntaxhighlight> '''$wgWPBEnableDefaultBanner''' enables the default banner image on pages without the use of <code><nowiki>{{PAGEBANNER}}</nowiki></code>. <syntaxhighlight lang="php"> $wgWPBEnableDefaultBanner = true; </syntaxhighlight> <translate><!--T:33--> <tvar name=1>'''$wgWPBNamespaces'''</tvar> array of namespaces on which to display the banner.</translate> <translate><!--T:34--> Default is Main namespace.</translate> <translate><!--T:35--> It can also be set to <tvar name=2>{{php|true}}</tvar>, in which case it'll enable banner on all Namespaces, except those excluded by <tvar name=1>'''$wgWPBDisabledNamespaces'''</tvar>.</translate> <syntaxhighlight lang="php"> $wgWPBNamespaces = [ NS_MAIN ]; </syntaxhighlight> <translate><!--T:36--> <tvar name=1>'''$wgWPBDisabledNamespaces'''</tvar> excludes certain namespaces from showing banner.</translate> <translate><!--T:37--> Note that this parameter only has effect if <tvar name=1>{{phpi|$wgWPBNamespaces}}</tvar> is <tvar name=2>{{phpi|true}}</tvar>.</translate> <translate><!--T:38--> Otherwise, this parameter is disregarded and only namespaces in <tvar name=1>$wgWPBNamespaces</tvar> are considered.</translate> <syntaxhighlight lang="php"> $wgWPBDisabledNamespaces = [ NS_FILE ]; </syntaxhighlight> '''$wgWPBStandardSizes''' is an array of standard predefined screen widths in increasing order of size. <syntaxhighlight lang="php"> $wgWPBStandardSizes = [ 320, 640, 1280, 2560 ]; </syntaxhighlight> '''$wgWPBEnablePageImagesBanners''' when set to true and {{ll|Extension:PageImages}} is installed will use a page image when no Wikidata image or locally defined image is set. <syntaxhighlight lang="php"> $wgWPBEnablePageImagesBanners = true; </syntaxhighlight> '''$wgWPBDisplaySubtitleAfterBannerSkins''' is an array of names of skins that should have the banner displayed in the site-notice area, instead of in the page subtitle (which is the default). <syntaxhighlight lang="php"> $wgWPBDisplaySubtitleAfterBannerSkins = [ 'minerva' ]; </syntaxhighlight> '''$wgWPBEnableHeadingOverride''' determines whether the page title is displayed overlayed on the banner image. Defaults to true. <syntaxhighlight lang="php"> $wgWPBEnableHeadingOverride = true; </syntaxhighlight> '''$wgWPBEnableMainPage''' determines whether a banner is allowed to be shown on the {{manual|Main Page}}. Defaults to false. <syntaxhighlight lang="php"> $wgWPBEnableMainPage = false; </syntaxhighlight> ==Examples== A few use examples with explanation: <syntaxhighlight lang="php"> {{PAGEBANNER:Grand_canyon.jpg}} </syntaxhighlight> Will add a banner using image [[commons:Grand_canyon.jpg|Grand_canyon.jpg]] as source locally or from wikimedia commons. <syntaxhighlight lang="php"> {{PAGEBANNER:Grand_canyon.jpg|icon-star=<Name of star article>|icon-unesco=<Name of Unesco Article>}} </syntaxhighlight> Will add a banner using image Grand_canyon.jpg as source locally or from wikimedia commons. Additionally will add icons with class names oo-ui-icon-star, oo-ui-icon-unesco. Set '''background-image''' property on theses classes in MediaWiki:Common.css to your desired icon. <syntaxhighlight lang="php"> {{PAGEBANNER:Grand_canyon.jpg|toc=yes|pgname=Some page}} </syntaxhighlight> Will add a banner using image Grand_canyon.jpg as source locally or from Wikimedia Commons. Additionally adds a Table of Contents inside banner. Sets the name displayed on banner as '''Some page'''. <syntaxhighlight lang="php"> {{PAGEBANNER:Grand_canyon.jpg|extraClass=class1 class2}} </syntaxhighlight> This will add a banner using the ''Grand_canyon.jpg'' image as source either locally or from Wikimedia Commons. It additionally adds CSS classes ''class1'' and ''class2'' to the '''.wpb-topbanner''' div. ==Example usage for banner from Wikidata== Make sure <code>$wgWPBBannerProperty</code> is set to correct Wikidata banner property. Then leave the image name empty, and set any other required parameters: <syntaxhighlight lang="text"> {{PAGEBANNER:|other options...}} </syntaxhighlight> This will use the banner image as set on the page's Wikidata item. If there is no banner image set for that item, or the page doesn't have a Wikidata item, a default image may be used (if <code>$wgWPBImage</code> is set). ==Styling== The extension has ample scope for styling the banner via [[Common.css]]. Here are some examples of common CSS changes. <syntaxhighlight lang="css"> .wpb-topbanner-toc { position: relative; } </syntaxhighlight> This sets the ToC to appear just below the banner in case it's long. Note that doing this would cause every banner page on a wiki to have the ToC at the bottom of the banner. However, using <code>bottomtoc=yes</code> as a paramter would only show the ToC at the bottom on the page it's used. <syntaxhighlight lang="css"> .wpb-topbanner .wpb-name { font-size: 1em; } </syntaxhighlight> Would set the font size of the banner name to 1 em (smaller than the default 2.2 em). <syntaxhighlight lang="css"> .wpb-banner-toc { line-height: 1em; } </syntaxhighlight> Would reduce the vertical spacing between lines of the ToC. <syntaxhighlight lang="css"> .wpb-topbanner-toc { margin-top: 5px; } </syntaxhighlight> Would set some blank space between the banner and ToC. {{OnWikimedia}} [[Category:Advertising extensions{{#translation:}}]] [[Category:Notification extensions{{#translation:}}]] [[Category:Wikibase extensions{{#translation:}}]]
摘要:
请注意,所有对MCServerWiki的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
MCServerWiki:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
该页面使用的模板:
模板:Anchor
(
编辑
)
模板:Ll
(
编辑
)
模板:Manual
(
编辑
)
模板:OnWikimedia
(
编辑
)
模板:Php
(
编辑
)
模板:Phpi
(
编辑
)
搜索
搜索
编辑“︁
帮助:横幅
”︁
添加话题