powergun Posted December 12, 2011 Share Posted December 12, 2011 Hello EXPERTS , i want to Frame many pages of same code so how to do it from one page example 1 = www.abcd.com/Frame1.html [has the code given below in it] <iframe src="http://abcdsecond.com/Frame1.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> www.abcd.com/Frame2.html [has the code given below in it] <iframe src="http://abcdsecond.com/Frame2.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> and so on , so is it possible to create one php script in www.abcd.com so when abcd.com/Frame1.html or Frame2.html or Frame3.html is run it will run this code <iframe src="http://abcdsecond.com/Frame1.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> <iframe src="http://abcdsecond.com/Frame2.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> <iframe src="http://abcdsecond.com/Frame3.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> would appreciate help Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/ Share on other sites More sharing options...
powergun Posted December 12, 2011 Author Share Posted December 12, 2011 please help Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297064 Share on other sites More sharing options...
powergun Posted December 12, 2011 Author Share Posted December 12, 2011 i have found this code ... <?php //default url if none is set $nourl = "http://www.domainname.com"; $url=$_GET["url"]; if(!$url) { $url=$nourl; } ?> <html> <head> <title>YOUR TITILE</title> </head> <frameset rows="85px,*" frameborder="NO" border="0" framespacing="0"> <frame src="frame.php?url=<?php echo"$url" ?>" name="frame" scrolling="NO" noresize> <frame src="<?php echo "$url"; ?>" name="main"> </frameset> <noframes> <body> </body> </noframes> </html> how to replace "<frameset rows="85px,*" frameborder="NO" border="0" framespacing="0"> <frame src="frame.php?url=http://website.com" name="frame" scrolling="NO" noresize> <frame src="http://website.com" name="main"> </frameset> <noframes> to this one====== <iframe src="http://website.com" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> ====== Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297078 Share on other sites More sharing options...
QuickOldCar Posted December 12, 2011 Share Posted December 12, 2011 You could have a list or array() of your urls, and then loop all the iframe codes within a foreach(). But sadly because many websites "jump out of frame", it will then just visit the first website that redirects and not show all your iframed sites. Try my site or yahoo as one of the url's and see. http://dynaindex.com http://www.yahoo.com <?php $site_array = array("http://www.imdb.com","http://www.bing.com/","http://www.dogpile.com"); foreach($site_array as $site){ echo "<iframe name='$site' src='$site' width='100%' height='100%' frameborder='0' ></iframe><br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297137 Share on other sites More sharing options...
powergun Posted December 12, 2011 Author Share Posted December 12, 2011 sir i do not want to rotate url what i want to do is for example when i put this url in browser http://website1one.com/?123.html it should generate this out put in browser <iframe src="http://website2two.com/123.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297147 Share on other sites More sharing options...
QuickOldCar Posted December 12, 2011 Share Posted December 12, 2011 by using $_GET <?php $frame = $_GET['frame']; if(isset($_GET['frame']) && $_GET['frame'] != ""){ ?> <iframe src="./<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> <?php } else { echo "no frame specified"; } ?> usage would be to visit in the browser this type url http://website1one.com/this-script-name/?frame=123.html Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297156 Share on other sites More sharing options...
QuickOldCar Posted December 12, 2011 Share Posted December 12, 2011 Do you realize that you can just include the page? include() <?php $page = $_GET['page']; if(isset($_GET['page']) && $_GET['page'] != ""){ include($page); } ?> http://mysite.com/this-script-name/?page=123.html Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297162 Share on other sites More sharing options...
QuickOldCar Posted December 12, 2011 Share Posted December 12, 2011 well it should really be this if are iframing from a different domain <?php $frame = $_GET['frame']; if(isset($_GET['frame']) && $_GET['frame'] != ""){ ?> <iframe src="<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> <?php } else { echo "no frame specified"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297164 Share on other sites More sharing options...
powergun Posted December 12, 2011 Author Share Posted December 12, 2011 quite similar function but it would be perfect if i can get the output i am desiring http://website1one.com/this-script-name/?frame=123.html should produce this code <iframe src="http://website2two.com/123.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> your current script code is Just Making this url in iframe 123.html can,t it put second domain in iframe including page 123.html i have heard using str replace it can be done ? by using $_GET <?php $frame = $_GET['frame']; if(isset($_GET['frame']) && $_GET['frame'] != ""){ ?> <iframe src="./<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> <?php } else { echo "no frame specified"; } ?> usage would be to visit in the browser this type url http://website1one.com/this-script-name/?frame=123.html Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297167 Share on other sites More sharing options...
QuickOldCar Posted December 12, 2011 Share Posted December 12, 2011 This should be able to do a simple page your own site, or also from a url <?php if(isset($_GET['frame']) && $_GET['frame'] != ""){ $frame = $_GET['frame']; } else { $frame = "./"; } ?> <iframe src="<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297168 Share on other sites More sharing options...
powergun Posted December 12, 2011 Author Share Posted December 12, 2011 yes sir this code is working perfectly fine when i run this url ?frame=123.html ?frame=http://website2two.com/123.html but i was wondering can this be done ?frame=123.html should read as <iframe src="http://website2two.com/123.html" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> instead of website1one.com/123.html This should be able to do a simple page your own site, or also from a url <?php if(isset($_GET['frame']) && $_GET['frame'] != ""){ $frame = $_GET['frame']; } else { $frame = "./"; } ?> <iframe src="<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297169 Share on other sites More sharing options...
Drummin Posted December 12, 2011 Share Posted December 12, 2011 You can add the domain name to the iframe path. <?php if(isset($_GET['frame']) && $_GET['frame'] != ""){ $frame = $_GET['frame']; } else { $frame = "./"; } ?> <iframe src="website1one.com/<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297171 Share on other sites More sharing options...
powergun Posted December 12, 2011 Author Share Posted December 12, 2011 special thanks to quickoldcard very expert [quick responce] and thank you drummin for your help You can add the domain name to the iframe path. <?php if(isset($_GET['frame']) && $_GET['frame'] != ""){ $frame = $_GET['frame']; } else { $frame = "./"; } ?> <iframe src="website1one.com/<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/252991-simple-help-needed/#findComment-1297174 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.