I want to display the youtube link stored in the database and just call the link but it can't
<div class="divideo">
<iframe width="560" height="315" src="<?php echo $link; ?>" frameborder="0" allowfullscreen></iframe>
</div>
but youtube can't connect
<div class="divideo">
<iframe width="560" height="315" src="<?php echo base_url(); ?>/path/<?php echo $link ?>" frameborder="0" allowfullscreen></iframe>
</div>
You should have to give the proper path of the video link if that link is in your server if you are using an external source then use a proper link in your src tag.
Related
I want to display youtube video on a page, the following is my code in order to fetch youtube video URL from the database stored in mysql and then display it by iterating using while loop. However, the iframe does not display any video inside it.
<?php
if ($get_result != false) {
while ($row = mysqli_fetch_array($get_result, MYSQLI_ASSOC)) {
?>
<iframe width="560" height="315" src="<?php echo $row["url"]; ?>" frameborder="0" allowfullscreen></iframe>
<?php
}
}
?>
I have also tried using video tag inside while loop but it does not display the Youtube video inside the video player.
Please help me to solve this issue.
You can use Youtube with embed, like this:
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo $row["url"]; ?>?autoplay=1&autohide=1&controls=1&showinfo=0&modestbranding=1&rel=0"></iframe>
The problem is with your URL value.Replace "watch?v=" in video url with "v/" and try again.For example I tried with
<iframe width="560" height="315"
src="https://www.youtube.com//v/txSGdNONUJE" frameborder="0" allowfullscreen></iframe>
The above code will work fine.
I am trying to access an item from the array, the issue is with the line:
src=$videoArray[0]
I have tried a few ways but none seem to work.
<?php
$videoArray = array(
"//www.youtube.com/embed/nEBHkEeH42Y",
"//www.youtube.com/embed/1GlticqrECU",
"//www.youtube.com/embed/BMOUsI8JIaI",
);
?>
<iframe width="520" height="280" src=$videoArray[0] frameborder="0" allowfullscreen></iframe>
You need <?php ?> tags for the array to echo out, and you are missing the quotes around the src attribute.
<iframe width="520" height="280" src="<?php echo $videoArray[0]; ?>" frameborder="0" allowfullscreen></iframe>
You forgot your PHP tags and echo statement:
<iframe width="520" height="280" src="<?php echo $videoArray[0]; ?>" frameborder="0" allowfullscreen></iframe>
or shorthand syntax:
<iframe width="520" height="280" src="<?= $videoArray[0]; ?>" frameborder="0" allowfullscreen></iframe>
<iframe width="520" height="280" src="<?php $videoArray[0] ?>" frameborder="0" allowfullscreen></iframe>
Maybe need reusable code...
<?php
$videoArray = array(
"//www.youtube.com/embed/nEBHkEeH42Y",
"//www.youtube.com/embed/1GlticqrECU",
"//www.youtube.com/embed/BMOUsI8JIaI",
);
foreach($videoArray as $videoLink) {
?>
<iframe width="520" height="280" src="<?php echo $videoLink; ?>" frameborder="0" allowfullscreen></iframe>
<?php
}
?>
I have a page called 'mas.php' where i retrieve values from database. An IFrame is present in mas.php page. It is defined as follows:
<iframe width="523" height="234" scrolling="No"
width="500" height="145" src="mail-to.php" frameborder="0"
name="myframe" ></iframe>
Now from mail-to.php page I have to navigate to mail.php for mailing.
The sequence is:
(mas.php-->mail-to.php[iframe]--->mail.php)......
here while using the iframe in 'mas.php' page can i navigate to 'mail-to.php' by defining id in iframe?
<iframe width="523" height="234" scrolling="No"
width="500" height="145" src="mail-to.php?id=<?php echo $row['id'];?>"
frameborder="0" name="myframe" ></iframe>
How can I get the video ID for youtube and vimeo videos embed code? A youtube video embed code looks like this:
<iframe width="560" height="315" src="http://www.youtube.com/embed/dbPmWbqAJPs" frameborder="0" allowfullscreen></iframe>
where the ID in this is dbPmWbqAJPs.
A vimeo embed code looks like this:
<iframe src="http://player.vimeo.com/video/62468031?color=00ff00" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
where the ID in this example is 62468031.
I don't want to replace those exact ids, but rather have a pregmatch/pregreplace that finds the id in any embed of vimeo and of youtube.
try this
vimeo
$string='<iframe src="http://player.vimeo.com/video/62468031?color=00ff00" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
preg_match_all( '~http://player.vimeo.com/video/(.*?)\?~si',$string,$M);
echo ($M[1][0]);
youtube :
$string='<iframe width="560" height="315" src="http://www.youtube.com/embed/dbPmWbqAJPs" frameborder="0" allowfullscreen></iframe>';
preg_match_all( '~http://www.youtube.com/embed/(.*?)\"~si',$string,$M);
echo ($M[1][0]);
Try below code for php, it works without pregmatch
i.e. :
http://vimeo.com/22222222
http://player.vimeo.com/video/22222222
http://vimeo.com/channels/staffpicks/22222222
http://vimeo.com/groups/groupsname/22222222
PHP Code :
$vimeoUrl = 'http://vimeo.com/channels/channelsName/22222222';
$fetchVimeoIdArr = explode('/', $vimeoUrl);
$idCounter = count($fetchVimeoIdArr) - 1;
$vimeoId = $fetchVimeoIdArr[$idCounter];
I have a plugin where is displayed some news with a like facebook button.
I would change the width of this like in this site:
(see the right sidebar)
http://www.fanpage.it/moody-s-boccia-anche-la-germania-e-la-prima-volta-per-la-merkel/
This is my site:
http://www.clouderize.it/michele/
For my button I use this url but whatever width value I set, the button dimension not change!
How can I do ?
<iframe
src="http://www.facebook.com/widgets/like.php?href=<? the_permalink(); ?>&layout=button_count&width=450&action=like&colorscheme=light&font&show_faces=false&height=64"
scrolling="no" frameborder="0"
style="border:none;">
</iframe>
try this
#fb-bar iframe{min-height:80px !important;}
<div id="fb-bar">
<fb:like href="link"></fb:like>
</div>
Or
<div id="fb-bar">
<iframe
src="http://www.facebook.com/widgets/like.php?href=<? the_permalink(); ?>&layout=button_count&width=450&action=like&colorscheme=light&font&show_faces=false&height=64"
scrolling="no" frameborder="0"
style="border:none;">
</iframe>
</div>