Forum Moderators: coopster

Message Too Old, No Replies

Margin's fail to be parsed as a "0" within a PHP page

Am I doing something wrong or does it completely not work?

         

sidyadav

9:50 am on May 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the deal:
I have some HTML, that I want to integrate in a PHP page within the "echo<<<EOF" function (not the echo() one).

Here's the code:


<?php

<!--some code--!>

echo <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>My Title</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REV="made" href="me@foo-widgets.com">
<META HTTP-EQUIV="Content-Language" CONTENT="EN">
<META NAME="author" CONTENT="Me">
<META NAME="copyright" CONTENT="(c) My Company">
<META NAME="robots" CONTENT="ALL">
<style>
<!--
.footer { display:inline!important; }
-->
</style>
</head>
<LINK REL="stylesheet" HREF="my_style_sheet.css">
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<--my content--/>
</body>
</html>

EOF;

<!--some code--!>

?>


Now the problem is that the <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> does not seem to be valid. If I run the script, all the margin's become default to 2 (when viewing with a browser), but the code remains the same when I view the source of the file.

The same code works well on an HTML page, but when its parsed in the PHP page, it fails to work.

Am I doing something wrong? Is it meant to be this way?

Any help would be most appreciated,
Sid

ergophobe

2:39 pm on May 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Honestly, I don't have a clue why this doesn't work since I never do it this way. Those margin settings have long been deprecated, though and should be in your CSS not your HTML. I can't even remember whether they are valid in HTML4. Have you tried the W3C validator?

One thing I can say is that this is not a PHP issue. Those settings are interpreted client side, not server side. PHP has nothing whatsoever to do with the client side. Do a view source, save the code, change the extension to html and you will have the same problem.

jatar_k

5:44 pm on May 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



doesn't sound like a php issue at all, is there padding etc in your my_style_sheet.css file?

if the generated code looks right but the browser shows it the wrong way then start lookin elsewhere as ergophobe said.

HarryM

6:02 pm on May 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try replacing <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> with <body style="margin:0;">

Or include body {margin:0;} in your page styles and just code <body> in your html.

Another point, I don't know if it's necessary, but I always put link statements before the </head> tag.

sidyadav

9:37 pm on May 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do a view source, save the code, change the extension to html and you will have the same problem.

Yes, I did that and it worked, infact thats the only reason I'm posting it in the PHP forum. And if you read my post, I said "The same code works well on an HTML page, but when its parsed in the PHP page, it fails to work."
by that, I actually meant the view source bit.

You could try replacing <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> with <body style="margin:0;">

Yes Thanks a LOT Harry! That worked.

Sid