I am using Facebox. I have to play mp3files in Facebox. I included facebox.js and facebox.css
My view code is:
<script type="text/javascript">
$(document).ready(function () {
$('a[rel*=facebox]').facebox();
}
</script>
$res= explode('/',$val['audio_file']);
<?=$res['1'];?>
I have to play this mp3 file in Facebox. Is it possible?
I have linked the mp3 file in anchor tag, then can I play that file in a facebox. Now it plays in big screen.
Include it in view
<script type="javascript">
$('#play').live('click', function(e) {
e.preventDefault();
link=this.href;
jQuery.facebox({ ajax: link });
});
</script>
<a id="play" href="<?=site_url('admin/test/playmp3/'.$val['id']);?>"><?=$res['1'];?></a>
Include it in controller
function playmp3($id)
{
$this->data['mp3'] = $this->test_model->getmp3($id);
$this->load->vars($this->data);
echo $this->load->view( $this->config->item('APP_template_dir').'admin/playmp3_view');
}
Create a new page playmp3_view and include it
<div style="">
<object type="application/x-shockwave-flash" data="<?=base_url().$this->config->item('APP_assets_admin').'/'.$this->config->item('APP_js');?>/player_mp3.swf" width="200" height="20">
<param name="movie" value="<?=base_url().$this->config->item('APP_assets_admin').'/'.$this->config->item('APP_js');?>/player_mp3.swf" />
<param name="FlashVars" value="mp3=<?=base_url().'uploads/'.$mp3->audio_file?>" /></object>
</div>
Related
There's a lot of examples about how to reload captcha image on clicking, they all have a 'captcha.php' as the image source, e.g.
<img id="captcha" src="captcha.php">
<a id='reload'>Refresh now</a>
$('#reload').click(function(){
$('#captcha').attr('src','captcha.php')
})
The image source in OpenCart in my form is
<img id="captcha_img" src="index.php?route=information/contact/securimage" alt="CAPTCHA Image" />
If I do this:
<script>
$(function() {
$('#captcha_img').click(function(){
$('img').attr('src', '<?php echo "index.php?route=information/contact/securimage" ?>?' + (new Date).getTime());
});
});
</script>
The first image loads, but when I click on the image, the new image doesn't load. Looks like I'm not specifying the correct URL. What path do I need to set in the script in OpenCart? Thank you.
<script>
$(function() {
$('#captcha_img').click(function(){
$(this).attr('src', '<?php echo "index.php?route=information/contact/securimage" ?>&time=' + (new Date).getTime());
});
});
</script>
Is that works?
I've came to an idea that looks very simple of how to hide video link to certain limit
Okay suppose we've
index.php
<?PHP
$media = 'http://www.some_site.com/get.php?id=2';
echo '<object id="mediaplayer" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701" standby="loading microsoft windows media player components..." type="application/x-oleobject" width="300" height="225">
<param name="filename" value="'.$media.'">
<param name="animationatstart" value="true">
<param name="transparentatstart" value="true">
<param name="autostart" value="true">
<param name="showcontrols" value="true">
<param name="ShowStatusBar" value="true">
<param name="windowlessvideo" value="true">
<embed type="application/x-mplayer2" src="'.$media.'" autostart="true" showcontrols="true" showstatusbar="1" bgcolor="white" width="300" height="225">
</object>';
?>
and get.php code
<?PHP
$id = $_GET['id'];
if ($id === '2') {
$file = "http://www.real_site.com/video/test.wmv";
echo $file;
} else {
echo "die well";
}
?>
so when we call http://www.some_site.com/get.php?id=2 it will brings http://www.real_site.com/video/test.wmv and it worked
i've noticed that it works fine even with youtube embedding code iframe vlc and the ugly brothers quicktime realplayer players ... etc but not with JW Player
here is the code of index.php for case of jwplayer
<?PHP
$media = 'http://www.some_site.com/get.php?id=2';
// suppose it leads to youtube link or of what jw player support
echo "<script type='text/javascript' src='player/jwplayer.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'player/player.swf',
'file': '".$media."',
'controlbar': 'bottom',
'width': '300',
'height': '225',
'skin': 'player/schoon.zip'
});
</script>";
?>
it print this error
so is there any reason or this ! ~ that out helps me a lot
Under:
'file': '".$media."',
Add:
'provider': 'video',
You should be all set!
You need redirect to media file instead of print file url:
<?PHP
$id = $_GET['id'];
if ($id === '2') {
$file = "http://www.real_site.com/video/test.wmv";
//echo $file;
header('Location: '.$file);
} else {
echo "die well";
}
?>
Hey guys im trying to make a javscript function that will execute php code. This is what I have that should work I think.
<script type="text/javascript">
function doit()
{
$.get("dumplings.php");
return false; }
</script>
Dumplings.php contains this
<?php
$format = '<OBJECT style="z-index:2; position:absolute; top:20%; left:44%;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="rice" ALIGN="">
<PARAM NAME=movie VALUE="rice.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="rice.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="rice" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT>';
echo $format;
?>
Here is my radio button:
<input name="sample_check3" id="sample_check3" value="1" type="radio" onclick="doit();"/>
Basically, it just does nothing. Any idea why its not working?
it propbably does something but when you fetch your page with the php code you do nothing with the result
try changing it to something like this
$.get("dumplings.php", function (data){
$('body').append(data);
});
the data will contain the data from your php page. In this example I just add it to the body. but you can do anything with it.
You must use $.get on a one of your's page element (
<span>,<div>,<p>
)
After radiobutton add
<div id="loadobjecthere"></div>
And change script to
<script type="text/javascript">
function doit()
{
$("#loadobjecthere").get("dumplings.php");
return false;
}
</script>
Also try to change onclick attribute to
"javascript:return doit();"
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 this code:
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function doSomething() {
$.get("supcont.php");
return false;
}
</script>
an i want to call this function when clicking on an img so i used this
<a href="#" onclick="doSomething();">
<img src="photo/suppc.png" width="295" height="36" href="" target="fenetreA"/>
</a>
but this doesn't work, is ther any one that can help me
$(function () {
$('img').live('click', function () {
$.ajax({
url:"supcont.php",
success:function (res) {
alert(res);
}
});
});
});
Put this anywhere:
<img id="img1" src="photo/suppc.png" width="295" height="36" href="" target="fenetreA"/>
Place this after you include JQuery.js
<script type="text/javascript">
$(document).ready(function () {
$("#img1").click(function(){
$.get("supcont.php");
});
});
</script>
More info here : http://api.jquery.com/click/
Check w3schools website. Much helpful to you regarding this.