Jump to content

Recommended Posts

Hi all,

 

small issue, i'm trying to develop a page that loads a video into and iframe, but the iframe is only visible if the video link is clicked on... right now i can get it to work only if i set the if statement ot always true... but need to have hte iframe come up only if video is clicked.. can i get some assistance on this?  b/c when i use "==" the video pops up in a new window

 

 

  <?php
$file="../../mmenu.htm";
include($file);
?><div class="whtbg"> 
        <div id="wrapper-2">

<div class="rcol">
<?php
if( $video == 'v'){
echo"
<iframe name='frame1' width='500' height='330' scrolling='no' frameborder='0' style='margin:0px auto;' ></iframe>
";
}
else{
// no video specified ... 
// display something (a blank <div>) to fill the same space.
echo"
<div style='width:500px; height:330px;background:none;'></div>
";
}
?>

<br />
<div class="c-gallery">

<a href="burn.php?v=burn.mp4" target="frame1" class="ad-wrap">
<img src="../../graphics/clients/jc-burn.png" alt="Jasmin" id="c-ad"/>
"Burn"
</a>

Link to comment
https://forums.phpfreaks.com/topic/156128-php-iframe-issue/
Share on other sites

I think you want to look at Javascript/CSS for this. As it will not require a page reload. If you want it to work though, remove the target="frame1" out of the link, as there is no frame1 on that page since the if statement has not ran and change your if to be this:

 

if (isset($_GET['v'])){
echo"
<iframe name='frame1' src='{$_GET['v']}' width='500' height='330' scrolling='no' frameborder='0' style='margin:0px auto;' ></iframe>
";
}

 

But, I think you are confused with PHP. I would recommend you look into using Javascript/CSS for this part. As that seems to me to be what you actually want to do and not have to have a page reload.

Link to comment
https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821851
Share on other sites

using javascript for this seems like there will have to be the iframe tag there at all times, i only ant the iframe to appear when video clicked on

 

It will be, but with CSS/Javascript you can hide the iframe until the link is clicked. Once the link is clicked you change the source of the iframe to be what you want and un-hide it.

 

As far as my code not solving the issue, I did not think it would, you probably left the "target=" part inside of the link which

 

If you want it to work though, remove the target="frame1"

 

as you can see I did advise you to remove that out of the link. Since there is no "frame1" on that page the target opens in it's default behavior (a new window).

Link to comment
https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821883
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.