在MediaWiki上创建一个模板页面,用于将给定参数替换为iframe

问题描述 投票:0回答:1

我正在使用Iframe插件和以下代码嵌入来自VK的视频:

<div style="float:right; margin: 0px 0px 25px 25px;"><iframe k="vk"
 p="video_ext.php?oid=349530500&id=456239067&hash=4561ee8657098af3&hd=2"
w="640" h="360" allowfullscreen="1" /></div> 

但我想写这样的东西

{{VkVideo|video_ext.php?oid=349530500&id=456239067&hash=4561ee8657098af3&hd=2}}

我应该在Template:VkVideo写什么?如果我写下面的代码

<div style="float:right; margin: 0px 0px 25px 25px;"><iframe k="vk"
 p="{{{1}}}"
w="640" h="360" allowfullscreen="1" /></div> 

由于某种原因,它不能代替论证。所以我使用模板的页面的HTML包含以下代码:

<div style="float:right; margin: 0px 0px 25px 25px;"><iframe id="Iframe1"
data-src="https://vk.com/{{{1}}}"
data-delay="50" width="640" height="360" frameborder="0" allowfullscreen=""></iframe></div>
mediawiki iframe templates markup
1个回答
0
投票

扩展标记不接受模板参数,因为它们需要输出HTML,需要屏蔽模板处理。尝试

<div style="float:right; margin: 0px 0px 25px 25px;">{{#tag:iframe||k=vk|p={{{1}}}|w=640|h=|360|allowfullscreen=1}}</div>

(见here

© www.soinside.com 2019 - 2024. All rights reserved.