Manual:$wgEnableScaryTranscluding

This page is a translated version of the page Manual:$wgEnableScaryTranscluding and the translation is 53% complete.
解析器: $wgEnableScaryTranscluding
允許從另一個wiki導入/引用模板。
引进版本:1.5.0 (r9860)
移除版本:仍在使用
允许的值:(布尔值)
默认值:false

细节

啟用跨維基引用(從另一個wiki引用頁面或模板)。 这个选项名字有点奇怪也是有原因的:它有点没效率,并且另一个wiki对模板的更改不会自动应用到本wiki

必須設置interwiki 表中的$wgEnableScaryTranscludingiw_trans才能啟用此功能。 或者,您可以使用Extension:Interwiki 來管理它。

如何使用跨維基引用

  • 啟用$wgEnableScaryTranscluding
    $wgEnableScaryTranscluding = true;
    
  • 確保相關的interwiki前綴在數據庫中的interwiki.iw_trans設置為1。

纯嵌入包含

你现在可以输入{{wiki:模板名称}}或{{wiki:主名字空间页面名称}}以从其他wiki嵌入包含页面。 但是,这会从其他的wiki嵌入包含页面内容到你的wiki,而不是模板的维基代码。 So, with the former, you will see the documentation, if any, but the template will not function, it will be as if you were viewing the template page on the foreign wiki - because you will be. Wikilinks on the transcluded page will appear to be blue links but will link to locations on the foreign wiki. Other issues may arise due to missing style sheets or JavaScript modules (T318060#9451386).

原始嵌入包含

You can also use {{raw:wiki:template name}} to do a raw transclude, where all templates on the foreign page are expanded as if they come from your wiki instead of the other wiki. This will display the results of the wikicode on your wiki. Templates function to the extent required pages exist locally: i.e. where the template displays a link that doesn't exist on the local wiki, the link will be red, where the template includes other templates nested within its code, local templates by those names will be called, and unless the required templates exist in the required form, the template will be broken. File links may function normally, depending on whether InstantCommons is in use on both the local and foreign wikis.

替换引用

You can substitute scary transcluded templates with {{subst:wiki:template name}} or {{subst:wiki:main namespace page name}}. The results will be similar to using raw but will save the fully expanded code to your wiki. With templates, this will have the effect of copying the code to the local wiki. (note: {{subst:raw:foo}} and {{subst:foo}} appear to be equivalent.)

嵌入包含非MediaWiki内容

This will work for wiki pages from wikis that use software other than MediaWiki to some degree, but the local MediaWiki software will attempt to parse the non-MediaWiki wikitext (such as MoinMoin) and html on the foreign wiki, resulting in some meaningless content and some content displayed other than as expected due to differing rules for dealing with HTML. Transclusion of non-wiki pages (HTML, code, etc.) will display plain text, those portions of any HTML that is allowed by the MediaWiki, and anything which intentionally or unintentionally includes things that MediaWiki interprets as wikicode, which will result in varying degrees of meaninglessness. Links not on a MediaWiki wiki page may be blue links but incorrectly direct to non-existent local pages and other styling or JavaScript errors may occur, as in "pure" transclusion.

參見