Topic: Outputs junk

Hi all,
  I am building a website using php, I split the layout into 3

1. header.php
2. $action.inc
3. footer.php

here $action keep changing and loads the desired content.

The problem:

When the page loads, it shows a gap in between header and content(main.inc or any othr file)

I have checked all the div tags, all are open and closed properly.
few pages are executingit properly, but rest of the pages shows this gap. Wheni looked at the soure(html- view source) I found "?" in that gap. but its not displaying anythingin the browser except a line gap.

could you pls let me know what will be the error?.

Thanks in Adv

God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

Re: Outputs junk

I always go like this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html dir="ltr">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en-us" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style type="text/css">
</style>
</head>
<body>
<?php if(!isset($page)){include "home.php";}else{include "$page.php";}?>
</body>
</html>

Your links must look like

<a href="index.php?page=aboutme">About Me</a>

And the "About Me" page should be aboutme.php
The URL would look like http://./index.php?page=aboutme
if page is not set it automatically included home.php (you can change to wheter you like as long as you change the PHP syntax).

This creates no blank spaces.

Re: Outputs junk

My code looks like this... Do i need to change the Doctype?

header.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My page Title</title>
<META NAME="Title" CONTENT="" />
<META NAME="Author" CONTENT="General Manager" />
<META NAME="Description" CONTENT="" />
<META NAME="Keywords" CONTENT="" />
<META NAME="Identifier" CONTENT="" />
<META NAME="organization-email" CONTENT="" />
<META NAME="Copyright" CONTENT="" />
<META NAME="coverage" CONTENT="Global" />
<META NAME="Robots" CONTENT="Index, Follow" />
<META NAME="revisit" CONTENT="30 days" />
<META http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link href="sns/style.css" rel="stylesheet" type="text/css">
<link href="sns/report.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="sns/jscripts.js"></script>
</head>
<body style="background-color:#ffffff; ">
<div class="wrap">
<!--  header_begin -->
   <div id="header">
      Header Here. . . .<br>
     <br style="line-height:56px ">
   </div>
<!--  header_end -->

main.inc

  <div id="content">
    <div style="width:678px; height:50px; margin-left:34px; margin-top:26px;">
    <div style="width:678px; height:50px; float:left;">        
        Home page
        
                asasdlasjdlasjdlas laskdjalsjkdaslkdjaskld
        GOTO <a href="index.php?action=search">Search Page</a>
                    
        </div>
    </div>
  </div>

footer.php

<!--  footer_begin  -->
   <div id="footer" >
   <div style="text-align:center;padding-top:10px " class="policy"><b>Powered by:</b></font><a target="_blank" href="#"><font color="#A8B2AF">xyz.com</font></a></div>
  </div>
<!--  footer_end  -->
</div>
</body>
</html>
God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

4 (edited by Strofanto 2006-03-29 11:38)

Re: Outputs junk

I think the issue is the <br style="line-height:56px "> in your header, it's some space.
No you don't have to change the Doctype, you used HTML 4.01 I used XHTML 1.1, they are simply different.


EDIT: On a second look you mixed up HTML and XHTML, if you want to go for HTML you have to remove the /> from your Meta tags, replacing it with a simple >.
Otherwise if you want to go for XHTML change the doctype, turn the meta tags to lower case (from META to meta) and close the <br> tag (to br />).

Re: Outputs junk

if the problem is with header, then i should get error in all the pages know. But I am getting this error in few pages only.. and the space in the Header is ok. Coz i removed the image below that. If not i have to upload the image and all...

Regarding Meta Tags, we usually use META in html pages. i think it ll not affect the page / code.

Do you think that, it will have some impact on the code?

God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

Re: Outputs junk

ameenullah wrote:

if the problem is with header, then i should get error in all the pages know. But I am getting this error in few pages only.. and the space in the Header is ok. Coz i removed the image below that. If not i have to upload the image and all...

Post the code of a page with the problem and one without the problem

ameenullah wrote:

Regarding Meta Tags, we usually use META in html pages. i think it ll not affect the page / code.

Do you think that, it will have some impact on the code?

No it will only make the page not HTML valid.

Re: Outputs junk

In between the two comment lines, i am getting "?" in the source after execution

Pages without error shows

<!--  header_end -->
<!-- Content_beigns -->

pages with error shows

<!--  header_end -->
?<!-- Content_beigns -->

In header.php / main.inc, there is no such character.

God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

Re: Outputs junk

I absolutely have no idea why those comments return an error, try removing them, if you need them try <?php //comment ?>

9 (edited by ameenullah 2006-03-29 12:28)

Re: Outputs junk

Thank you Strofanto, finally its fixed, one of my friend, suggested me to open a new file and paste the code alone removing tabs and (extra)spaces. I did the same. Now its working fine.

Stil i Dont have the clue - why i got that error? but what I think is, there may be some hidden character while creation of file.

thanks alot for your support Strofanto.

God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

Re: Outputs junk

You're welcome.