ccrevcypsys Posted August 15, 2007 Share Posted August 15, 2007 On the site i am creating i can listen to previews of songs but my question is this: How do I make it to where only one song plays at a time? Heres the code for the .php file <?php $view_order=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/viewMymusic.tpl"); if($ccUserData[0]['customer_id']>0){ $view_order->assign("LANG_PRODUCT",$lang['front']['viewOrder']['product']); $view_order->assign("LANG_PRODUCT_CODE",$lang['front']['viewOrder']['product_code']); $view_order->assign("LANG_QUANTITY",$lang['front']['viewOrder']['quantity']); $view_order->assign("LANG_PRICE",$lang['front']['viewOrder']['price']); $products = $db->select("SELECT *,".$glob['dbprefix']."CubeCart_inventory.type as type FROM ".$glob['dbprefix']."CubeCart_order_inv LEFT JOIN ".$glob['dbprefix']."CubeCart_order_sum on ".$glob['dbprefix']."CubeCart_order_inv.cart_order_id=".$glob['dbprefix']."CubeCart_order_sum.cart_order_id LEFT JOIN ".$glob['dbprefix']."CubeCart_inventory on ".$glob['dbprefix']."CubeCart_inventory.productId=".$glob['dbprefix']."CubeCart_order_inv.productId LEFT JOIN ".$glob['dbprefix']."CubeCart_customer on ".$glob['dbprefix']."CubeCart_customer.customer_id=".$glob['dbprefix']."CubeCart_inventory.customer_id WHERE ".$glob['dbprefix']."CubeCart_order_sum.customer_id=".$ccUserData[0]['customer_id']); if($products == TRUE){ for($i=0;$i<count($products); $i++){ if($products[$i]['digital']==1 && ($products[$i]['status']>=2 && $products[$i]['status']<=3) ){ // get digital info $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_Downloads INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_Downloads.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE cart_order_id = ".$db->mySQLSafe($products[$i]['cart_order_id'])." AND ".$glob['dbprefix']."CubeCart_Downloads.productId = ".$db->mySQLSafe($products[$i]['productId']); $download = $db->select($query); $view_order->assign("VAL_DOWNLOAD_LINK",$glob['songURL']."/download.php?pid=".$download[0]['productId']."&oid=".base64_encode($products[$i]['cart_order_id'])."&ak=".$download[0]['accessKey']); $view_order->assign("LANG_DOWNLOAD_LINK",$lang['front']['viewOrder']['download_here']); $view_order->parse("view_order.session_true.order_true.repeat_products.digital_link"); } if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$products[$i]['image'])){ $view_order->assign("SRC_PROD_THUMB",$glob['songURL']."/images/uploads/thumbs/thumb_".$products[$i]['image']); } else { $view_order->assign("SRC_PROD_THUMB",$glob['songURL']."/skins/".$config['skinDir']."/styleImages/thumb_nophoto.gif"); } if($i%2==0) $view_order->assign("TD_CLASS","bgcolor='#61a2df'"); else $view_order->assign("TD_CLASS","bgcolor='#ffffff'"); $view_order->assign("PRODUCT_ID",$products[$i]['productId']); $view_order->assign("VAL_PRODUCT",$products[$i]['name']); $view_order->assign("VAL_PRODUCT_OPTS",$products[$i]['product_options']); $view_order->assign("VAL_IND_QUANTITY",$products[$i]['quantity']); $view_order->assign("TXT_ALBUM_NAME",$products[$i]['albumName']); $view_order->assign("VAL_IND_PROD_CODE",$products[$i]['productCode']); $randnum=rand(100,999); if($products[$i]['type']=='Song') $view_order->assign("TXT_DIGITAL_SAMPLE","<p id='player".$products[$i]['productId']."'><a href='http://www.macromedia.com/go/getflashplayer'>Get the Flash Player</a> to see this player.</p><script type='text/javascript'> var s".$products[$i]['productId']." = new SWFObject('player/flvplayer.swf?.$randnum','single','17','20','7');\n s".$products[$i]['productId'].".addVariable('file','".$products[$i]['digital_sample']."'); \n s".$products[$i]['productId'].".addVariable('image','preview.jpg');\n s".$products[$i]['productId'].".write('player".$products[$i]['productId']."');\n</script>"); else $view_order->assign("TXT_DIGITAL_SAMPLE","<p id='player".$products[$i]['productId']."'><a href='http://www.macromedia.com/go/getflashplayer'>Get the Flash Player</a> to see this player.</p><script type='text/javascript'> var s1 = new SWFObject('player/flvplayer.swf?.$randnum','playlist','100','50','7'); s1.addVariable('file','playlist.php?prodid=".$products[$i]['productId']."'); s1.addVariable('displayheight','0'); s1.addVariable('width','100'); s1.addVariable('backcolor','0x000000'); s1.addVariable('frontcolor','0xCCCCCC'); s1.addVariable('lightcolor','0x557722'); s1.write('player".$products[$i]['productId']."');</script>"); $view_order->assign("VAL_IND_PRICE",priceFormat($products[$i]['price'])); $view_order->assign("TXT_ARTIST",validHTML($products[$i]['firstName']." ".$products[$i]['lastName'])); $view_order->assign("VAL_PRODUCT_CODE",validHTML($products[$i]['productCode'])); $view_order->parse("view_order.session_true.order_true.repeat_products"); } $view_order->parse("view_order.session_true.order_true"); } else { $view_order->assign("LANG_NO_ORDERS",$lang['front']['viewOrder']['order_not_found']); $view_order->parse("view_order.session_true.order_false"); } } else { include("login.inc.php"); } if($ccUserData[0]['customer_id']>0) $view_order->parse("view_order.session_true"); else $view_order->parse("view_order.session_false"); $view_order->parse("view_order"); $page_content.=$view_order->text("view_order"); ?> I also was wondering if i had to deal with that in the database. Someone please help me. Link to comment https://forums.phpfreaks.com/topic/65108-how-do-i/ Share on other sites More sharing options...
php_tom Posted August 15, 2007 Share Posted August 15, 2007 Your code is too long, plus the classes you call are missing, I can't help you unless you narrow own the problem part of the code. Are you making a playlist somewhere? If so, give us the code for that only. Link to comment https://forums.phpfreaks.com/topic/65108-how-do-i/#findComment-324981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.