Jump to content

Linux - Windows Server Problem


whittierpc

Recommended Posts

Hello People!
I have been using php for about 1 year and I developed a site on a linux server about 1 year ago and then had to move the server because I started using another language, long story short I am on a windows server now and I used Creating Interactive Websites with PHP and Web Services to help me build the site so I utilitized the layout discussed in Chapter 4, well on the Linux Server the site worked beautifully, now on the windows server the site looks ok, problem is that I have this space above the pages that use the layout template.

How do I fix this?

The code is practically this

<?php

include $_SERVER['DOCUMENT_ROOT']."/common.php";

function myheader($ptitle){
$meta = &new Meta;
$meta->company_name = "My Company";
$meta->description = "This is my first PHP enabled website.";
$meta->keywords2 = "PHP, MySQL, Web Development";
$meta->sitename = "My PHP Site";
$meta->slogan = "Be patient, I'm learning!";
$meta->generator = "PHP";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<?php echo $meta->metadata($ptitle); ?>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="3"><a href="/"><img src="/images/logo.jpg" ALT="My PHP Site" BORDER="0"></a><hr size="1"></td>
</tr>
<tr>
<td colspan="3">
<?php
include $_SERVER['DOCUMENT_ROOT'].
'/html/forms/search_form.html';
?>

</td>
</tr>
<tr>
<!-- Left Links Column -->
<td width="170" valign="top">
<table width="170" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10">&nbsp;</td>
<td valign="top">
<?php
include $_SERVER['DOCUMENT_ROOT'].
'/boxes/member_box.php';

include $_SERVER['DOCUMENT_ROOT'].
'/boxes/box_admin_links.php';

include $_SERVER['DOCUMENT_ROOT'].
'/boxes/box_main_links.php';

include $_SERVER['DOCUMENT_ROOT'].
'/boxes/box_books.php';

include $_SERVER['DOCUMENT_ROOT'].
'/boxes/box_translate.php';

include $_SERVER['DOCUMENT_ROOT'].
'/boxes/box_quick_stats.php';
?>
</td>
<!-- End Left Links Column -->
<td width="10">&nbsp;</td>
</tr>
</table>
</td>
<td valign="top">
<!-- End Header and Begin Content -->
<?php
}
function footer(){
?>
<!-- End Content and Begin Footer -->
</td>
<!-- Right Column Boxes and Links -->
<td width="130" valign="top">
<?php
include $_SERVER['DOCUMENT_ROOT'].
'/boxes/box_shopping_cart.php';
?>
</td>
<!-- End Right Column Boxes and Links -->
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td width="130" nowrap>&nbsp;&nbsp;&nbsp;</td>
</tr>
</table>
</body>
</html>
<?php
}
?>
Link to comment
Share on other sites

I had the same problem, really annoyed me, I "accidently" found the solution. It is this line:
[code]HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">[/code]
You could either stick with HTML or move up to XHTML, might require some practice getting used to it (if you don't already know it that is [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]) but anyways, try replacing that with:
[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/code]
Should fix some problems, might make some new problems, depending on your HTML code. If all else fails, go back to HTML 4.01 :) I don't know the correct doctype code for HTML 4.01, so you'll probably have to look it up. Sorry.

Good luck,
Benj
Link to comment
Share on other sites

I actually do not have that line in my code I just have the open <html> tag, but I don't quite get your solution, I should learn XHTML and then change my existing html to xhtml?

Just want to make sure I got it right.

I added that line in my code were it should go and it didn't help.
Thanks
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I actually do not have that line in my code I just have the open <html> tag[/quote]
That line is in the code you provided!

Anyway... this sounds more like a client-side issue than a server-side one. Did you switch browsers recently also?
Link to comment
Share on other sites

sorry my actual code was a lot longer so I just pasted the code listed in the book because it was quicker, I have not changed browsers, when I developed I was using Safari on Mac and Firefox on Windows, and I get the same problem now on both browsers. Problem is that I don't know what this problem is called and don't know where to search for a solution?
Link to comment
Share on other sites

I still think it's the DOCTYPE, I tried mutiable browers with my website that was having problems. IE worked fine, Firefox didn't work to well, Konquour worked badly. I added that line, and they all worked fine.

No, I'm not saying learn XHTML, it's 95% the same as HTML, most of the HTML works of XHTML. But I'm not sure what could be the problem if the DOCTYPE isn't it.

Oh, and I'm not to sure about this, but if you don't include that line, most browsers set the default to HTML? Is that right? Or does it work as XHTML?
Link to comment
Share on other sites

Here is the actual code

<?php
include $_SERVER['DOCUMENT_ROOT'].'common.php';
function myheader($ptitle){
//include $_SERVER['DOCUMENT_ROOT'].'classes/clsMetaContent.php';
$meta = &new Meta;

$meta->company_name = "";
$meta->description = "";
$meta->keywords2 = "";
$meta->sitename = "";
$meta->slogan = "";
$meta->generator = "";
$id=$_REQUEST[id];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $meta->metadata($ptitle); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><style type="text/css">
<!--
body {
margin-top: 0px;
}
-->
</style></head>
<body bgcolor="#FFFFFF" leftmargin="0" marginwidth="0">
<table id="Table_01" width="800" height="648" border="0" cellpadding="0" cellspacing="0">
<tr>
<td rowspan="2">
<img src="images/home_01.gif" width="1" height="277" alt=""></td>
<td>
<a href="http://www.roaring.com"><img src="images/home_02.gif" alt="" width="118" height="28" border="0"></a></td>
<td>
<a href="/home.php?id=<?=$id?>"><img src="images/homeblue.gif" alt="" width="75" height="27" border="0"></a></td>
<td> <a href="/contactus.php?id=<?=$id?>"><img src="images/home_04.gif" alt="" width="100" height="28" border="0"></a></td>
<td>
<a href="/help.php?id=<?=$id?>"><img src="images/home_05.gif" width="98" height="28" border="0" alt=""></a></td>
<td>
<a href="/hd.php?id=<?=$id?>&cat=app"><img src="images/home_06.gif" alt="" width="78" height="28" border="0"></a></td>
<td>
<a href="/about.php?id=<?=$id?>"><img src="images/home_07.gif" alt="" width="100" height="28" border="0"></a></td>
<td>
<a href="/private.php?id=<?=$id?>"><img src="images/home_08.gif" width="121" height="28" alt="" border="0"></a></td>
<td>
<a href="/pc.php?id=<?=$id?>"><img src="images/home_09.gif" width="109" height="28" alt="" border="0"></a></td>
</tr>
<tr>
<td colspan="8">
<img src="images/burbank_home_10.gif" width="799" height="249" alt=""></td>
</tr>
<tr>
<td colspan="9">
<img src="images/home_11.gif" width="800" height="371" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
<div id="Login Form" style="position:absolute; left:659px; top:295px; width:139px; height:96px; z-index:13">
<form action="/login.php" method="post">
<table width="139" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <input name="username" type="text" id="username" value="<?=$_POST['username'];?>" size="18"></td>
</tr>
<tr>
<td height="3"></td>
</tr>
<tr>
<td><input type="hidden" name="req" value="validate"></td>
</tr>
<tr>
<td><input name="password" type="password" id="password" size="18"></td>
</tr>
<tr>
<td>
<input type="image" src="images/okbutton.gif" value="submit"></td>
</tr>
</table>

</form>
</div>
</body>
</html>
<?php
}
function footer(){
?>
<?php
}
?>
Link to comment
Share on other sites

[!--quoteo(post=387692:date=Jun 25 2006, 01:44 AM:name=Benj RooZ)--][div class=\'quotetop\']QUOTE(Benj RooZ @ Jun 25 2006, 01:44 AM) [snapback]387692[/snapback][/div][div class=\'quotemain\'][!--quotec--]
There might be something in the common.php or clsMetaContent.php that's adding the extra space, because I don't see anything that could cause extra space, whats in those file by the way?
[/quote]

I have the list of most commonly used files like the connection to the database and classes for Shopping Cart and Email, what really gets me is that on the Linux Server I did not have these problems, it really makes me scratch me head
Link to comment
Share on other sites

Wait, I remember the other problem that could cause it.
Edit: Forgot to give a reason why it was happening :P Well, new lines for some reason, sometimes create spaces, which make extra lines on the outcome of the webpage.
The easiest way to fix it is to delete all new lines after <td> and before </td>
That should work, good luck :)
Benj
Link to comment
Share on other sites

I FOUND IT!

I got the bright idea to check the source of my webpage and saw a </br> tag before my <html> tag and wondered how that got there, so I checked the common.php file after having check everything else and sure enough it was there! Thanks for all your help.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.