OOP style messing with CSS design?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sequalit
Forum Commoner
Posts: 75
Joined: Wed Oct 12, 2005 9:57 pm
Location: Texas

OOP style messing with CSS design?

Post by Sequalit »

Why is my OOP statements making my CSS completely stop?

its weird, but I have two pages, one OOP and one non OOP, and they both use the same stylesheet.

But the one with OOP, when it hits that line with the first OOP statement, the CSS stops styling the page, and any text/graphics after that dont get displayed.

as you can see i use a OO class to deal with my session... is there any way around this or a way to fix this?

heres the code

NON WORKING PHP FILE:

Code: Select all

<?php
	define("x",null);
	include_once('session.php');
	$ses = new session();
	include_once('OOPObjects.php');
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>pagenamehere - N00BL33T.COM</title>
<link href="CSS.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="container">
<!-- HEADER - BANNER -->
	<div id="header">
		<h1>Header - Banner</h1><br />
				
	</div>
<!-- FIRST ROW COLUMN -->
<!-- LOGIN -->
	<div id="login">
		<p>
			Login:<br />
			<?php
				if($ses->isLogged()==FALSE){
					echo "Welcome Guest!<br />";
					echo "<a href='login.php'>Login</a>";
				}else{
					echo "Welcome Member!";
				}
			?>
		</p>
	</div>
<!-- NEWS -->
	<div id="news">
		<p> Testimonies:<br />
			Yet to come...
	  </p>
	</div>
<!-- SECOND ROW COLUMN -->
<!-- NAVBAR -->
	<div id="navigation">
		<p>
			Navbar:<br />
			<a href="index.php">Home</a>
		</p>
	</div>
<!-- STATS -->
	<div id="stats">
		<p>
			Stats:<br />
			No Site Statisitcs Availiable.
		</p>
	</div>
<!-- MIDDLE - MAIN CONTENT -->	
	<div id="content">
		<?php 
			//$content->displayPage("news");
		?>
	</div>
<!-- FOOTER - Copyrights -->	
	<div id="footer">
	</div>
</div>

</body>
</html>
WORKING PHP FILE:

Code: Select all

<?php
	session_start();
	define("x",null);
	include('sources/variables.php');
	include('sources/functions.php');
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>pagenamehere - N00BL33T.COM</title>
<link href="CSS/000.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="container">
<!-- HEADER - BANNER -->
	<div id="header">
		<h1>Header - Banner</h1><br />
	</div>
<!-- FIRST ROW COLUMN -->
<!-- LOGIN -->
	<div id="login">
		<p>
			Login:<br />
			<?php
				displayInfo();
			?>
		</p>
	</div>
<!-- NEWS -->
	<div id="news">
		<p>
			News:<br />
			No New News.
		</p>
	</div>
<!-- SECOND ROW COLUMN -->
<!-- NAVBAR -->
	<div id="navigation">
		<p>
			Navbar:<br />
			<a href="index.php">Home</a>
		</p>
	</div>
<!-- STATS -->
	<div id="stats">
		<p>
			Stats:
		</p>
	</div>
<!-- MIDDLE - MAIN CONTENT -->	
	<div id="content">
		<?php 
			displayPage();
		?>
	</div>
<!-- FOOTER - Copyrights -->	
	<div id="footer">
	</div>
</div>

</body>
</html>
CSS file

Code: Select all

a:visited{
	color:#FFFFFF;
}

#container{
	width:90%;
	margin:10px auto;
	background-color:#000099;
	color:#0066FF;
	border:1px solid blue;
	line-height:130%;
}


#header{
	background-color:#000066;
	border-bottom:1px solid black;
	padding:.5em;
	text-align:center;
}
#header h1{
	margin:0;
	border:0;
}


#login{
	float:left;
	width:150px;
	padding:.5em;
	border:1px solid black;
	border-style:outset;
	min-height:7.5em;
}
#navigation{
	clear:left;
	float:left;
	width:150px;
	padding:.5em;
	border:1px solid black;
	border-style:outset;
	min-height:7.5em;
}
#login p, #navigation p{margin:0 0 .1em 0;}


#news{
	float:right;
	width:150px;
	padding:.5em;
	border:1px solid black;
	border-style:outset;
	min-height:7.5em;
}
#stats{
	clear:right;
	float:right;
	width:150px;
	padding:.5em;
	border:1px solid black;
	border-style:outset;
	min-height:7.5em;
}
#news p, #stats p{margin:0 0 .1em 0;}

#content{
	margin-left:10em;
	margin-right:10em;
	padding:1em;
}
#content h2{
	margin:0 0 0 0;
	text-align:center;
	border:1px solid #0066FF;
}
#content h3{
	margin-top:1em;
	margin-bottom:0;
	border:1px solid #0066FF;
}


#footer{
	clear:both;
	margin:0;
	padding:.5em;
	border-top:1px solid black;
	background-color:#000066;
	text-align:center;
}
#footer p{
	margin:0;
	padding:0;
}

.textbox{
	padding:1em;
	margin-top:0;
	border:1px solid #0066FF;
}
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Having not looked at your source...I can't say exactly what the problem is...

But speaking from experience...it's usually due to an error in your PHP code somewhere...

If PHP chokes and spits out an error which affects one or more tags, the browser cannot render the web page properly and sometimes it's not obvious.

Remove your PHP code and try again and incrementally insert the code, until you have found the code block which caused the choke and fix it!!!

Just an suggestion :)
Post Reply