Yes, you heard me, Iframes out. Yes a site can work without them. Calm down
Why would you wanna get rid of Iframes?
1. They’re old
2. Too “limiting”
3. Its harder to get on Google etc. with them.
4. They’re un-professional IMO.
So we’re gonna get rid of them using PHP ![]()
Note: Remember to save all your files that use this method with the .php extension.
Lets say you got your index page which is:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YourCrapSite.com</title>
</head>
<body>
<center><img src="layout.jpg" alt="" /></center>
<div style="position:absolute; width: 250px; height:3000px; top:111px; left:18px;">
<iframe name="side" src="side.php" width="100%" height="3000" frameborder="0" scrolling="no"></iframe>
</div>
<div style="position:absolute; width: 377px; height:3000px; top:112px; left:279px;">
<iframe name="main" src="main.php" width="100%" height="3000" frameborder="0" scrolling="no"></iframe>
</div>
</body>
</html>
First you’re gonna need to create a header.php file, which contains all your design, stylesheets, layouts etc. that comes before your content. In this case:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YourCrapSite.com</title>
</head>
<body>
<center><img src="layout.jpg" alt="" /></center>
<div style="position:absolute; width: 250px; height:3000px; top:111px; left:18px;">
<?php include('side.php'); ?>
</div>
<div style="position:absolute; width: 377px; height:3000px; top:112px; left:279px;">
and a footer.php file which in the case contains:
</div>
</body>
</html>
For side.php remove everything except for the content eg: <div class=”header”> and <div class=”content”> and their contents
So after all that we’re you’re gonna change the index page to:
<?php include('header.php'); ?>
<?PHP
$number=10;
include("/home/yoursite/public_html/cutenews/show_news.php");
?>
<?php include ('footer.php'); ?>
All done
No related posts.

Personally, i would disagree with you, iFrames are an integral part of including external content into a website. If someone wishes to include a php page from another server into their php based site, iframes are the only solution applicable.
As for your particular ” inventiveness ” this is simply a waste of a post, as there’s absolutely no need to use iFrame for server side inclusion of information. there are multiple alternatives including php, css, ajax, and a plethora of other examples could be given.
There’s also no need to create the header / footer php’s. a single HTML file will suffice for your header / footer pages. and a simple would do the trick.
so in essence your entire post is pointless. and should have read like thus:
To replace iFrames for server-side-includes, use php instead:
replace:
with:
:p
Comment by Chris M. on October 11, 2009 at 7:20 am