Php Smarty:如何刮擦&按关键字嵌入YouTube视频?

时间:2011-07-02 11:55:52

标签: php youtube embed smarty keyword

请有人让我看一些例子吗?真的很谢谢你。 我找到了一些东西,但现在我有另一个问题: 例如,我在tpl中有以下javascript:

    <script src="http://www.domain.com/script.js" type="text/javascript"></script>

<div id="youtubeDiv"></div>
<script type="text/javascript">
insertVideos({'block':'youtubeDiv','q':'keyword','type':'search','results':8,'order':'most_relevance','player':'embed','layout':'thumbnails'});</script>
{literal} {/ literal}之间的

让它工作......但是如何用smarty变量替换“keyword”{$ product.name} ???

2 个答案:

答案 0 :(得分:0)

好的,解决了...代替'keyword':

'{/literal}{$mySmarty_variable}{literal}'

答案 1 :(得分:0)

<form onsubmit="insertVideos({'block':'youtubeDivSearch','type':'search','q':document.getElementById('ytSearchField').value,'results': 20,'order':'most_relevance','layout':'thumbnails'}); return false;">
    <input id="ytSearchField" type="text" />
    <input type="submit" value="  Search  " />
</form>

<div id="youtubeDivSearch"></div>

<script src="http://www.yvoschaap.com/ytcp.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js" type="text/javascript"></script>

<div id="youtubeDiv"></div>
<div id="youtubeDivUser"></div>

<script>insertVideos({'block':'youtubeDivUser','type':'user','q':'','results': 20,'layout':'thumbnails','player':'embed','imgstyle':'3px solid #333'});</script>