View Full Version : php site in iframe

02-02-2010, 02:14 PM
hi, i am relatively new to php so yah =]

basically i want to display a php site with script and all in an iframe (or any solution)

this is my code for the main site

sites is roflwaffles.net (http://roflwaffles.net) (click on generator tab, then server 1)

<a href="http://imakethisfoofun.co.cc" target="iframe">Server 1</a>

<iframe name="iframe" src ="#" width="718px" height="500px" frameborder="0" scrolling="yes">
If you can read this your browser does not support iframes.

i dont think there is that cause it can redirect to other sites fine.

when you try to click on the link, it redirects no to the box but the entire page changes.

i've been trying to figure this out for days, help please


02-02-2010, 02:56 PM
Are you going to give it a source to put into the <iframe>?
src ="#"

Also, and I'm not sure about this ... take out (remove) the px's in these:
width="718px" height="500px"

02-02-2010, 02:57 PM
not a php question.

the site that your trying to view is busting out of the iframe?

this is because of some javascript on the site to not allow this.

if (window.parent && window.parent.location != window.location)
window.parent.location = window.location;

02-02-2010, 07:41 PM
I would recommend against using frames at all in your site design, although many sites do it. If not all the proper javascripts are wrote when people google your site and find a page they may get that page without the parent frame (ie no navigation to get to the other pages.) I would instead recommend using php's include to include a header and footer file.

Your header file - header.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
<link rel="SHORTCUT ICON" href="images/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>::. RoflWaffles - Premium Link Generator .::</title>
<script language=javascript>
if (window.parent && window.parent.location != window.location)
window.parent.location = window.location;
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="file, generator, premium, Rapidshare, link, sharing" />
<link rel="stylesheet" href="images/style.css" type="text/css" media="all">
<link rel="stylesheet" href="images/print.css" type="text/css" media="print">
<script type="text/javascript" src="images/dbx.js"></script>
<script type="text/javascript" src="dbx-key.js"></script>
<link rel="stylesheet" type="text/css" href="images/dbx.css" media="screen, projection"><!--[if lt IE 7]>
<link rel="images/stylesheet" type="text/css" media="screen" href="images/sociable.css"></head><body>
<style type="text/css">
.style1 {
<div id="page">
<div id="wrapper">
<div id="header">
<p align="center">
<br><a><img src="images/header.png" alt="Roflwaffles premium link generator" align="center"></a>
<!-- /header -->
<div id="nav">
<ul style="width: 875px; height: 12px">
<li class="page_item"><a href="index.html">Home</a></li>
<li class="page_item"><a href="generator.php">Link Generator</a></li>
<li class="page_item"><a href="contact.html">Contact Us</a></li>
<li class="page_item"><a href="donate.html">Donate An Account</a></li>
</div><!-- /nav -->

<div id="content" style="width: 718px">

<div class="post" id="post-1493">
<div class="title">
<h2>Select a Server</h2>

<div id="nav2">
<ul style="width: 875px; height: 12px">
<li class="page_item"><a href="http://imakethisfoofun.co.cc" target="iframe">Server 1</a></li>
<li class="page_item"><a href="servers/server2/index.php" target="iframe">Server 2</a></li>
<li class="page_item"><a href="servers/server3/index.php" target="iframe">Server 3</a></li>
<li class="page_item"><a href="servers/server4/index.php" target="iframe">Server 4</a></li>


your footer file - footer.php

<!-- /page nav -->

</div><!--/content -->

<!--/left-col -->

<!--/sidebar -->
<hr class="hidden">

</div><!--/wrapper -->

<br><script language="JavaScript" src="http://www.counter160.com/js.js?img=6"></script><br><a href="http://www.***************"><img src="http://www.counter160.com/images/6/left.png" alt="Free web hosting" border="0" align="texttop"></a><a href="http://www.hosting24.com"><img alt="Web hosting" src="http://www.counter160.com/images/6/right.png" border="0" align="texttop"></a>

</div><!--/page -->


Then on each of your frame pages use this...

include 'header.php';
This is where you would put you content from the iframe.
include 'footer.php';

Like I said it's definitely not necessary but will give you a better site in my opinion. Also when you direct someone to an anchor tag using the # at the end of a url it gets annoying if they didn't request it. Other than that the design isn't half bad although I'm completely clueless on the point of your sight.

02-03-2010, 12:53 AM
thanks for the response guys! =]

Basically the site has many link generators.
when i get too many users, (as i had before) the server crashese

so what i want to do is place them on seperate servers but everyone can access through the main domain (using frames)

or if there is a way to "mask" the address of the additional servers to show "www.roflwaffles.net" that would be even better

this way, i dont want the visitors to bookmark specific servers but that they can only bookmark the main domain (roflwaffles.net)

02-03-2010, 12:59 AM
not a php question.

the site that your trying to view is busting out of the iframe?

this is because of some javascript on the site to not allow this.

if (window.parent && window.parent.location != window.location)
window.parent.location = window.location;

thank you very much!!!i found the problem. i am new to javascript and php, i mostly learned HTML in my spare time so i dont know very much :o

this javascript was preventing it =O


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum