Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP ?> include body not shifting left

    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

    Code:
    <!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

    Code:
    <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

    Code:
    <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.
    Last edited by Fou-Lu; 08-02-2011 at 07:14 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.

  • #3
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Why are you using tables (when it's stupid) and HTML5? It's nearly a contradiction in terms.

  • #4
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Apostropartheid View Post
    Why are you using tables (when it's stupid) 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:

    Code:
    <!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>
    Last edited by Fou-Lu; 08-02-2011 at 07:14 PM.

  • #5
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by Doraku View Post
    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:

    Code:
    <!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!
    Last edited by Fou-Lu; 08-02-2011 at 07:15 PM.

  • #6
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    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.
    Teed


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •