100 Web Space
http://forum.100webspace.com/

Odd PHP and CSS problem
http://forum.100webspace.com/viewtopic.php?f=5&t=4480
Page 1 of 1

Author:  Adam [ Sun Jun 04, 2006 10:52 pm ]
Post subject:  Odd PHP and CSS problem

Hello.

I've got my H1 tag defined in my stylesheet. For some reason my PHP pages are ouputting the H1 tag like this:
Code:
<h1><font>Blah</font></h1>

Instead of this:
Code:
<h1>Blah</h1>

Any ideas what might be causing that?

Author:  Adam [ Sun Jun 04, 2006 10:58 pm ]
Post subject: 

The code involved:
Code:
echo '<center><h1>Blah</h1></center>';

Code:
h1{
size: x-large;
color: #fffff0;
weight: bold;
background-color: #d17c80;
}

Author:  =cipher= [ Mon Jun 05, 2006 1:05 am ]
Post subject: 

Greetings,

Now my question is, does your HTML code in your 'echo' statement look like the one you would like it to be?

Author:  Adam [ Mon Jun 05, 2006 1:29 am ]
Post subject: 

Nope. The PHP is this:
Code:
echo '<center><h1>Blah</h1></center>';

The HTML output is this:
Code:
<center><h1><font>Blah</font></h1></center>

I have no idea how it is inserting the extra tags. And somehow the FONT tag is overriding the H1 tag properties.

Author:  =cipher= [ Mon Jun 05, 2006 2:58 am ]
Post subject: 

Greetings,

Sorry, I miss understood your original question. Are you sure you have not added the <font></font> tags?

Author:  Adam [ Mon Jun 05, 2006 1:03 pm ]
Post subject: 

Absolutely. I've checked and checked again. I'm wondering if your PHP there is inserting them around echoed strings, or if I've accidentally somehow included something in my script which is doing that. Going by past experience, it's entirely probable that I've done something weird, but I thought I'd ask just in case.

Author:  Adam [ Mon Jun 05, 2006 4:19 pm ]
Post subject: 

The CSS:
Code:
body{
margin-left: 5;
margin-right: 5;
margin-top: 5;
margin-bottom: 5;
background-color: #a4595c;
font-family: arial, "arial";
font-color: #d17c80;
}

font{
font-size: medium;
color: #d17c80;
style: normal;
variant: normal;
weight: normal;
}

font.form{
font-size: medium;
color: #d17c80;
style: normal;
variant: normal;
weight: normal;
}

h1{
size: x-large;
color: #fffff0;
font-color: #fffff0;
weight: bold;
background-color: #d17c80;
}

h2{
size: large;
color: #a4595c;
weight: bold;
background-color: #d17c80;
}

h3{
size: medium;
color: #a4595c;
weight: bold;
background-color: #d17c80;
}

hr{
width: 100%;
color: #fffff0;
}

p{
text-align: justify;
color: #d17c80;
font-size: medium;
}

a:link{
color: #fffff0;
font-size: small;
font-weight: bold;
text-decoration: underline;
}

a:visited{
color: #fffff0;
font-size: small;
font-weight: bold;
text-decoration: underline;
}

a:active{
color: #fffff0;
font-size: small;
font-weight: bold;
text-decoration: underline;
}

a:hover{
color: #aa0000;
background-color: #fffff0;
font-size: small;
font-weight: bold;
text-decoration: none;
}

a.menu:link{
color: #ee0000;
font-size: medium;
font-weight: bold;
text-decoration: underline;
}

a.menu:visited{
color: #ee0000;
font-size: medium;
font-weight: bold;
text-decoration: underline;
}

a.menu:active{
color: #ee0000;
font-size: medium;
font-weight: bold;
text-decoration: underline;
}

a.menu:hover{
color: #fffff0;
background-color: #ee0000;
font-size: medium;
font-weight: bold;
text-decoration: none;
}

table{
border-width: 1;
border-style: solid;
border-color: #fffff0;
spacing: 0;
padding: 0;
background-color: #aa0000;
}
tr{
vertical-align: top;
}
td{
vertical-align: top;
}

table.form{
border: 0;
spacing: 0;
padding: 0;
background-color: #aa0000;
}
tr.form{
vertical-align: top;
}
td.form{
vertical-align: top;
}

table.menu{
border-width: 1;
border-style: solid;
border-color: #fffff0;
spacing: 0;
padding: 0;
background-color: #aa0000;
}
tr.menu{
vertical-align: top;
}
td.menu{
vertical-align: top;
}

th{
color: #ee0000;
background-color: #aa0000;
}

.buttons{
color: #aa0000;
font-weight: bold;
background-color: #fffff0;
}

input:focus, textarea:focus{
background-color: #fffff0;
}

The file using it:
Code:
<?php

include("files/configuration.php");
include("files/top.php");

if($online == 1) // This variable set to 0 makes the site offline, 1 makes it online.
{
include("files/menu.php");
include("files/login.php");
}
else
{
echo '<center><h1>Coming soon!</h1></center>';
}

include("files/bottom.php");

?>

Author:  Adam [ Mon Jun 05, 2006 4:20 pm ]
Post subject: 

The link: http://workshop.freefronthost.com/

Author:  Adam [ Mon Jun 05, 2006 4:55 pm ]
Post subject: 

Index.php: http://100ws.pastebin.com/760130

Top.php: http://100ws.pastebin.com/760132

Bottom.php: http://100ws.pastebin.com/760134

Configuration.php: http://100ws.pastebin.com/760138

Author:  Revaroo [ Mon Jun 05, 2006 5:44 pm ]
Post subject: 

Quite obvious the top.php file...

Code:
<?php

include("files/configuration.php");

echo '<html>';
echo '<head>';
echo ' <title>'.SITE_TITLE.'</title>';
echo ' <link rel="stylesheet" type="text/css" href="'.SITE_CSS.'">';
echo '</head>';
echo '<body><font>';
?>

Author:  Adam [ Mon Jun 05, 2006 6:03 pm ]
Post subject: 

Revaroo wrote:
Quite obvious the top.php file...

Nope, I don't see how that top.php is managing to insert 'font' tags inside a string from index.php. What am I missing?

Author:  Adam [ Fri Jun 09, 2006 6:36 am ]
Post subject: 

PsychoticDude85 wrote:
It isn't...

echo '<body><font>';

Should be:

echo '<body>';


I just wanted to also include the font tag there in case I output any regular font in the page without it being inside any other containers. But even if I remove that font tag, how are extra font tags being inserted into that output string?

Author:  Adam [ Fri Jun 09, 2006 9:36 am ]
Post subject: 

Yep, you were right, removing that font tag worked. Thanks very much.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/