graphic3 Posted April 29, 2009 Share Posted April 29, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/156128-php-iframe-issue/ Share on other sites More sharing options...
premiso Posted April 29, 2009 Share Posted April 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821851 Share on other sites More sharing options...
graphic3 Posted April 29, 2009 Author Share Posted April 29, 2009 do you know a page that can get me started in the right direction on how to do w/ js? Quote Link to comment https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821862 Share on other sites More sharing options...
premiso Posted April 29, 2009 Share Posted April 29, 2009 http://www.google.com/#hl=en&q=javascript+dynamic+iframe Quote Link to comment https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821865 Share on other sites More sharing options...
graphic3 Posted April 29, 2009 Author Share Posted April 29, 2009 the code you posted doesn't solve the issue, it still loads the video into another window... 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 Quote Link to comment https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821876 Share on other sites More sharing options...
premiso Posted April 29, 2009 Share Posted April 29, 2009 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). Quote Link to comment https://forums.phpfreaks.com/topic/156128-php-iframe-issue/#findComment-821883 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.