首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SilverStripe CMS Unity3D网页播放器嵌入问题

SilverStripe CMS Unity3D网页播放器嵌入问题
EN

Stack Overflow用户
提问于 2011-04-12 10:08:26
回答 1查看 1K关注 0票数 1

我正在尝试添加Unity3D (www.unity3d.com)网络播放器到我的网站与SilverStripe的内容管理系统版本2.4.5。似乎发生的情况是,SS正在动态地删除我的包含web播放器的代码。它会留下一个结束的div标签。

对于一个简单的静态页面来说,嵌入web播放器是非常简单的。您需要以下代码,它可以完美地工作。HTML:

代码语言:javascript
复制
<script type="text/javascript" src="http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js"></script> 
  <script type="text/javascript"> 
  <!-- 
   //gets the unityPlayer div and replaces the content with an embed tag which is the web player made by Unity (it works outside of SS.) 
  function GetUnity() { 
     if (typeof unityObject != "undefined") { 
        return unityObject.getObjectById("unityPlayer"); 
     } 
     return null; 
  } 
  //sets the parameters of the web player 
  if (typeof unityObject != "undefined") { 
     unityObject.embedUnity("unityPlayer", "MazePuzzle.unity3d", 720, 450); 

  } 
  --> 
  </script>

<div id="unityPlayer"> 
        <div class="missing"> 
           <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!"> 
              <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" /> 
           </a> 
        </div> 
     </div>
EN

回答 1

Stack Overflow用户

发布于 2011-04-13 16:07:26

在内容域中插入javascript被认为是不好的做法,这就是为什么wysiwyg编辑器会删除script元素的原因。不过,你可以通过配置tinymce来解决这个问题(有关如何做的更多信息,请参阅this thread )。

更好的方法可能是使用silverstripe 2.4+中支持的短码。您可能会在编辑器中看到类似以下内容:

unity width=720高度=450MazePuzzle.unity3d/unity

关于短码的docs有点稀疏,但你可以在ssbits上找到一个很好的教程

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5629633

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档