...

View Full Version : PHP ?> include body not shifting left



Doraku
07-21-2011, 09:00 PM
This may even be a HTML issue but I don't know. I'm having problems adjusting the body text to the far left next to the menu and it keeps going to the far right. I think I've left a lot of redundant tags. I have been adjusting things and now it is far left under the menu. Argh.

My code:

INDEX.PHP




<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8">
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<?PHP include "header.php"; ?>
<table width="95%" cellpadding="1" cellspacing="1" align="center">
<tr valign="top">
<td valign="top" align="left" width="165">
<?PHP include "menu.php"; ?></td>
<td valign="top" align="left" width="150px"/>
<?PHP include "body.php"; ?></td>
<td valign="top" align="right" width="150px"/></td>
</tr></table>
</body>
</html>



MENU.PHP



<html>
<head>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
</div>
<div id="site">
<header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Web Hosting</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Support</a></li>
</ul>
</nav>
</header>
</div>


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="js/linkswipe.js"></script>
</body>
</html>


BODY.PHP



<html>
<body>
<table width="95%" cellpadding="1" cellspacing="1" align="center">
<tr valign="top">
<td valign="top" align="left" width="165">
<p align="left">Body text</p>
</tr>
</table>
<p align="left">Body text</p>
</body>
<?PHP include "footer.php"; ?>
</html>




Cheers.

Fou-Lu
07-21-2011, 09:06 PM
Browser display is definitely a client issue.
Moving from PHP to HTML/CSS. You'll need to provide a link to the site or the resulting output HTML for the client guys to diagnose the issue (which will be a modification potentially in PHP).

What I can tell you right now is you will have HTML issues since you have <html> tags with multiple head and body tags included by the includes. You will need to remove these from the included scripts in order to provide them properly to the script that is including them.

Apostropartheid
07-21-2011, 09:53 PM
Why are you using tables (when it's stupid) (http://www.hotdesign.com/seybold/) and HTML5? It's nearly a contradiction in terms.

Doraku
07-21-2011, 10:24 PM
Why are you using tables (when it's stupid) (http://www.hotdesign.com/seybold/) and HTML5? It's nearly a contradiction in terms.

Because I'm learning and I blindly followed what was on the tutorial. I have now noted that they are stupid. I will be reading more about CSS.

I removed the excess <html> tags. This is the output:



<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8">
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta name="description" content="Description"></meta>
<meta name="keywords" content="Keywords"></meta>
<header>
<img src="images/header.png" />
</header> <table width="95%" cellpadding="1" cellspacing="1" align="center">
<tr valign="top">
<td valign="top" align="left" width="165" bgcolor="#FFF">
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</div>
<div id="site">
<header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Web Hosting</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Support</a></li>
</ul>
</nav>
</header>
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="js/linkswipe.js"></script>
</td>
<td valign="top" align="left" width="150px"/>
<table width="95%" cellpadding="1" cellspacing="1" align="center">
<tr valign="top">
<td valign="top" align="left" width="165">
<p align="left">Body text</p>
</tr>
</table>
<p align="left">Body text</p>
</td>
<td valign="top" align="right" width="150px"/></td>
</tr></table>


</body>
</html>

Apostropartheid
07-22-2011, 01:53 AM
Because I'm learning and I blindly followed what was on the tutorial. I have now noted that they are stupid. I will be reading more about CSS.

I removed the excess <html> tags. This is the output:



<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8">
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta name="description" content="Description"></meta>
<meta name="keywords" content="Keywords"></meta>
<header>
<img src="images/header.png" />
</header> <table width="95%" cellpadding="1" cellspacing="1" align="center">
<tr valign="top">
<td valign="top" align="left" width="165" bgcolor="#FFF">
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</div>
<div id="site">
<header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Web Hosting</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Support</a></li>
</ul>
</nav>
</header>
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="js/linkswipe.js"></script>
</td>
<td valign="top" align="left" width="150px"/>
<table width="95%" cellpadding="1" cellspacing="1" align="center">
<tr valign="top">
<td valign="top" align="left" width="165">
<p align="left">Body text</p>
</tr>
</table>
<p align="left">Body text</p>
</td>
<td valign="top" align="right" width="150px"/></td>
</tr></table>


</body>
</html>



Whilst you're still using tables, you are very unlikely to get help. I'm very sorry about this, but it's rather like applying a plaster to an amputation; there's simply no purpose in fixing an outdated model. In addition, many younger (i.e. entered web development in the past five years) web developers will be unlikely to have familiarity with tables.

If you're lucky, somebody may chip in and help you. But, as I said, it's unlikely. Sorry!

teedoff
07-22-2011, 04:10 PM
Well it does appear that you have neglected to close your head section AND you opened you body section before all meta tags and closing your head section.


But, since you're new and learning, I would recommend validating the above code and you will see about 40 errors that should be fixed. Validation is always a good first step in debugging code rendering issues. You can validate your html here (http://validator.w3.org/).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum