开发者

Php Smarty: how to scrape & embed a youtube video by keyword?

please could someone let me see some examples? Really Thank You. I found something but now i have another problem: for example i have the following javascript inside a tpl:

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

<div id="youtubeDiv"></div>
<script type="text/javascript">
insertVideos({'block':'开发者_如何学JAVAyoutubeDiv','q':'keyword','type':'search','results':8,'order':'most_relevance','player':'embed','layout':'thumbnails'});</script>

between {literal}{/literal} to let it work... but how to replace the "keyword" with the smarty variable {$product.name} ???


ok, solved... in place of 'keyword':

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


<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜