MediaWiki:如何在模板中为父页面创建一个部分?
我使用模板在我的一些网站中包含一个特殊的框。模板代码后面有一些内容,这些内容在视觉上属于 temaplte 创建的框。现在我想让编辑结果框中的内容变得更容易。
我的想法是在框的右上角添加一个“编辑”链接,该链接将打开编辑器,仅显示该框的内容。由于标题会自动创建部分,我尝试在模板中添加一个部分。但这只是为模板本身创建了一个编辑链接。
如何使模板在父页面本身中创建一个新的“部分”?
I use a template to include a special box in some of my sites. After the template code there is some content, that visually belongs to the box created by the temaplte. Now I want to make it easier to edit the content of the resulting box.
My idea was to add an 'edit' link to the top right of the box, that opens the editor with only the content of this box. As headlines automatically create sections, I tried adding one to the template. But this only created an edit link for the template itself.
How can I make the template create a new 'section' in the parent page itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。编辑链接将指向其 wiki 文本中包含该部分代码的页面(直接,不包含)。通常的方法是让模板包含一些子页面,并将编辑链接指向该子页面。
简单版
模板:
当您将此模板放置在页面
Foo
上时,它将包含子页面Foo/stuff
(第三行,请参见此处了解FULLPAGENAME
的说明)并显示指向它的编辑链接(第二行,请参阅此处用于fullurl
)。基于 Parserfunction 的版本
如果您安装了ParserFunctions 扩展,您可以使用它来检测是否子页面存在:
You can't. The edit link will point to page which has the section code in its wikitext (directly, not included). The usual method is to have the template include some subpage, and point the edit link to that subpage.
Simple version
Template:
When you place this template on page
Foo
, it will include the subpageFoo/stuff
(third line, see here for explanation ofFULLPAGENAME
) and show an edit link to it (second line, see here forfullurl
).Parserfunction-based version
If you have the ParserFunctions extension installed, you can use it to detect whether the subpage exists: