Can anyone explain how to embed a swf object into a facebook canvas page via PHP.
<?php
function sswf($swf,$swfh,$swfw) {
echo "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0' ID=objects WIDTH=$swfw HEIGHT=$swfh><PARAM
NAME=movie VALUE='$swf'><EMBED src='$swf' WIDTH=$swfw HEIGHT=$swfh TYPE='application/x-shockwave-flash'
PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></OBJECT>";
}
$mf = "mmmm1.swf";
sswf($mf,690,1000);
?>
The code above no longer works although it did last week.... What's wrong with it?
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var params = {allowFullScreen:'false', allowscriptaccess:'always', wmode:'opaque'};
var flashvars = {};
var attributes = { name:"xxx", id:"xxx" };
swfobject.embedSWF("xxx.swf?<? echo(time()) ?>", "xxx", "520", "500", "9.0", null, flashvars, params, attributes);
</script>
<div id="fb-root"></div>
<div id="xxx">
<h1>You need at least Flash Player 9 to view this page.</h1>
<p><img src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></p>
</div>
Related
I have a jQuery notification. When I click on the notification it should go the intended page.
In PHP we can achieve that by doing following.
$link = 22;
echo "Click to read more";
How to achieve such in JQuery? I have notification pop up and link variable ready.
var link = "home.php?destination=22";
You can create HTML element using jQuery
var link = "home.php?destination=22";
//Create anchor element
var anchor = $('<a />', {
"href": link,
"text": "Click to read more"
})
//Append the element
$('#dialog').append(anchor).dialog();
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<div id="dialog" title="Basic dialog">
</div>
you can achieve it using window.location.href in java script.
<button onclick="myFunction()">Click me to read more</button>
<script>
function myFunction() {
window.location.href = 'home.php?destination=22';
}
</script>
I need to get the url for the artists track from the mysql databse for it to be played through jplayer. I achieved it with the normal html audio controls but cannot do it with jplayer as the audio source is entered in javascript.
Here's how i achieved it with the html player;
<?php
include ("../database.php");
$result = mysql_query("SELECT * FROM tracks WHERE artistname='$artistname'");
while($row = mysql_fetch_array($result)){
?>
<br><br>
<audio controls="controls" height="50px" width="100px">
<source src=<?php echo $row['trackurl'] ?> type="audio/mp3" />
<embed height="50px" width="100px" src="song.mp3" />
</audio>
<?php } <?
Heres the javascript for jplayer:
<script type="text/javascript">
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: "http://localhost/uploads/dde85d7907e516545ba0860ef1ac23f2.mp3"
});
},
swfPath: "../jplayer",
supplied: "mp3"
});
});
The url from the mysql databse needs to go where it says:
mp3: "http://localhost/uploads/dde85d7907e516545ba0860ef1ac23f2.mp3"
You can use AJAX to get the the value and pass it to the jPlayer
In your javascript make a variable of track like
var mp3file='<?php echo $row['trackurl']; ?>';
and then
$(this).jPlayer("setMedia", {
mp3: "mp2file"
});
This will work if you fetching a single song. If you fetching data in array then you need AJAX
I have downloaded a flash component "Fade In Fade Out Slideshow".and included my images in it. I don't know how to include it in drupal
its index.html page is
<html xmlns="http`enter code here`://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>XML Banner Rotator</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
// JAVASCRIPT VARS
// cache buster
var cacheBuster = "?t=" + Date.parse(new Date());
// stage dimensions
var stageW = "560";//"100%";
var stageH = "374";//"100%";
// ATTRIBUTES
var attributes = {};
attributes.id = 'FlabellComponent';
attributes.name = 'FlabellComponent';
// PARAMS
var params = {};
params.bgcolor = "#ffffff";
params.menu = "false";
params.scale = 'noScale';
params.wmode = "opaque";
params.allowfullscreen = "true";
params.allowScriptAccess = "always";
/* FLASH VARS */
var flashvars = {};
/// if commented / delete these lines, the component will take the stage dimensions defined
/// above in "JAVASCRIPT SECTIONS" section or those defined in the settings xml
flashvars.componentWidth = stageW;
flashvars.componentHeight = stageH;
/// path to the content folder(where the xml files, images or video are nested)
/// if you want to use absolute paths(like "http://domain.com/images/....") then leave it empty("")
flashvars.pathToFiles = "banner/";
// path to content XML
flashvars.xmlPath = "xml/banner.xml";
/** EMBED THE SWF**/
swfobject.embedSWF("preview.swf"+cacheBuster, attributes.id, stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params, attributes);
</script>
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<td align="center">
<!-- this div will be overwritten by SWF object -->
<div id="FlabellComponent">
<p>In order to view this object you need Flash Player 9+ support!</p>
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
</a>
</div>
</td>
</table>
</body>
</html>
i have downloaded a flash component "Fade In Fade Out Slideshow".and included mu images in it.i don't know how to include it in drupal
any idea????
i tried to embed its preview.swf using the below code..but flash image doesn't displays.
<div id="swfhead">
<object height="205" width="950">
<param value="preview.swf" name="movie">
<embed height="205" width="950" src="preview.swf">
</object>
</div>
You cant embed swf as you did. Please refer theme concepts in drupal.org
Bio : http://drupal.org/user/1313260
I am trying to include a piece of code from Google Conversion Tracking into my business contact from which is based on Jomla. The code should be integrated once the Thank you message appears but unfortunately I am very unexperienced with javascript and php. Could someone please give me a hand having these two pieces of code combined?
Thank you very much, James
Code Jomla
//<![CDATA[
<!--
window.addEvent('load', function() {
changeCaptcha(".$this->profile->id.",0);\n".($use_ajax?"resetSubmit(".$this->profile->id.");\n":"")."
if($(typeof SqueezeBox!='undefined' && 'system-message')) {
SqueezeBox.initialize();
SqueezeBox.open($('system-message'), {
handler: 'adopt',
size: {x: $('system-message').offsetWidth+30, y: $('system-message').offsetHeight+30}
});
}
});
//-->
//]]>
Code Google:
<!-- Google Code for Contact Form Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1033530737;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "A8yvCJrs4AIQtHey6hT";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript"
src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt=""
src="http://www.googleadservices.com/pagead/conversion/1033530737/? label=A8yvCJrs4AIQtHey6hT&guid=ON&script=0"/>
</div>
</noscript>
It has a joomla plugin that includes the conversion code on the default page of the contact: http://www.joomlaadwordsconversion.com/
So I am using the jsplayer HTML5 player on my wordpress site, as well as some custom script to load in the next post and replace the old content once the video is finished:
$(document).ready(function(){
$(".video-js").livequery('ended', function(){
var sStr = "<?php echo get_permalink(get_adjacent_post(true,'',true)); ?>";
var adj_numb = "<?php
$adj = get_adjacent_post(true,'',true);
$numb = $adj->ID;
echo $numb
?>";
var cur_numb = "<?php echo $post->ID; ?>";
$.post(sStr, function(data) {
var content = $( data ).find( '#post-' + adj_numb);
$( "#post-" + cur_numb ).html( content );
var vid = VideoJS.setup( "vid" );
vid.play();
});
});
});
This works great, for 2 videos. It loads in the next video and plays it, and one after that, but after the 3nd video plays it just stops. I figure this means I have to sort of "reset" all my variables and start again from the beginning of the script, and that it's not doing this because of $(document).ready(function(), as it's already all loaded at this point.
Is there a standard way to loop through this script again, and re-set all the variables after its run once?
Or am I approaching the whole issue incorrectly?
Thanks!
Rendered JS:
$(document).ready(function(){
$(".video-js").livequery('ended', function(){
var sStr = "http://www.theloniousfilms.com/zachmath/volkswagon/";
var adj_numb = "94";
var cur_numb = "96";
$.post(sStr, function(data) {
var content = $( data ).find( '#post-' + adj_numb);
$( "#post-" + cur_numb ).html( content );
var vid = VideoJS.setup( "vid" );
vid.play();
});
});
});
HTML:
<div class="post-96 post type-post status-publish format-standard hentry category-zachmath" id="post-96">
<h2 id="director">Director Name</h2>
<h2 id="post_title">Post-Name
<span id="post_name">
"Hot Tub"
</span>
<span id="home">HOME</span>
<div class="entry">
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody --><br />
<video id="vid" class="video-js" width="640" height="360" preload autoplay poster="http://www.site.com/wp-content/uploads/2011/03/poster.jpg"><br />
<source src="http://d29zgp48wvs9kv.cloudfront.net/orkin.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /><br />
<source src="http://d29zgp48wvs9kv.cloudfront.net/orkin.ogv" type='video/ogg; codecs="theora, vorbis"' /><br />
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. --><br />
<object class="vjs-flash-fallback" width="640" height="360" type="application/x-shockwave-flash"<br />
data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"><param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" /><param name="allowfullscreen" value="true" /><param name="flashvars" value='config={"playlist":["http://www.theloniousfilms.com/wp-content/uploads/2011/03/poster.jpg", {"url": "http://d29zgp48wvs9kv.cloudfront.net/orkin.m4v","autoPlay":true,"autoBuffering":true}]}' /><!-- Image Fallback. Typically the same as the poster image. --><br />
</object><br />
</video>
</div>
I ended up going with a different method, where I pulled all the posts URLs into a array, then iterated through each of them, going to the next item in an array once playback finished.