Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Info - products extra videos


dstebo

Recommended Posts

how can I use this code in: http://jsfiddle.net/BinaryMuse/5BKYZ/4/

 

in that: http://pastebin.com/SVhxNTZq

 

var youtube_video_id = "Cgovv8jWETM";
var video_url = "http://youtube.com/watch?v=" + youtube_video_id;
var thumbnail_url = "http://img.youtube.com/vi/" + youtube_video_id + "/1.jpg";
var iframe_url = "http://www.youtube.com/embed/" + youtube_video_id + "?autoplay=1";
var api_url = "https://gdata.youtube.com/feeds/api/videos/" + youtube_video_id + "?v=2&alt=json-in-script&callback=?"

 

error: var youtube_video_id = "<?php echo $urlFinal; ?>";

Link to comment
Share on other sites

Uh, I'm a bit confused by where you're starting from and where you're trying to end up. Do you get that error message from the browser or is it on the server side? If the browser is giving you that message (as a Javascript error), it means that you're probably giving PHP code mixed in with Javascript, but not passing it through PHP to expand/process it. For example, the JS (with embedded PHP) is in a .js file brought in with a <script> tag? That code should work if it's in a .php file.

 

On the other hand, if it's the server complaining, my guess would be that you have Javascript code in a place where PHP code is expected (within <?php .. ?>). You would have to have the JS code in an HTML block (outside of <?php .. ?>), or rewrite it to be echo '....JS code...'; echoed out in PHP:

echo 'var youtube_video_id = '.$urlFinal.';';

Link to comment
Share on other sites

how to put image loading, when you click the video delay to visualize

 

<script src="scripts/video/jquery.tools.min.js" type="text/javascript"></script>
<script type="text/javascript">
var youtube_video_id = "<?php echo $urlFinal; ?>";
var video_url = "" + youtube_video_id;
var thumbnail_url = "http://img.youtube.com/vi/" + youtube_video_id + "/1.jpg";
var iframe_url = "" + youtube_video_id + "?autoplay=1";
var api_url = "https://gdata.youtube.com/feeds/api/videos/" + youtube_video_id + "?v=2&alt=json-in-script&callback=?";
$(function() {
 // Get video information and set the title.
 $.getJSON(api_url, function(data) {
   $(".info").html("<b><a href='" + video_url + "' target='_blank'>" + data.entry.title.$t + "</a></b>");
 });
 // Set the thumbnail image for the video.
 $(".preview img.thumb").attr("src", thumbnail_url);
 // Switch to the iframe when the image is clicked.
 $(".preview").click(function() {
   $(this).html("<iframe width='480' height='385' src='" + iframe_url + "' frameborder='0' allowfullscreen></iframe>");
   $(this).css("float", "none");
 });
});
</script>

 

DIV

 <div class="preview">
   <img class="thumb">
   <img class="play" src="tv.jpg">
 </div>

 

CSS

<style type="text/css">
.preview {
 position: relative;
 cursor: pointer;
 float: left;
 padding-right: 2px;
}
.play {
 position: absolute;
 left: 0px;
 bottom: 0px;
}
</style>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...