punstc
06-16-2008, 09:38 PM
I'm pretty new at php just learning. I'm working on a basic little blog, for a project and having problems with my css not showing up when i put my php into my xhtml. Can anyone explain to me why this might be happening here's my code.
<?php
require('php/db_connect.php');
$sql = "SELECT id, title, date, content FROM jchamb_blog ORDER BY date DESC LIMIT 3 ";
$result = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JChamb Designs</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="header_info">
<h1>JChamb</h1>
<h3>Hi, I'm a Mac.</h3>
</div><!--header_info-->
<div id="banner"> </div>
<div id="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Who</a></li>
<li><a href="#">Work</a></li>
<li><a href="#">Archive</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Links</a></li>
</ul>
</div><!--nav-->
<div id="content">
<h6>Who?</h6>
<p> Jake Chamberlain be the name, and design would so happen to be the game! I like lots of things including Apple, Flash, and Hambuger Helper. I find myself addicted to Mac Rumors, and CNN. I can somtimes spend hours if not days without seeing sun light. <a href="#" title="Full Bio">Full...</a></p>
<br />
<h6>Recent Posts</h6>
<?php
while($row = mysql_fetch_assoc($result)) {
$id = $row['id'];
$title = $row['title'];
$date = $row['date'];
$content = substr($row['content'],0, 500);
echo "<div class=\"post\">";
echo "<hr />";
echo "<span class=\"titles\">$title</span>";
echo "<span class=\"dates\">$date</span>";
echo "<p class=\"content\"> $content";
if(strlen($content) > 500) {
echo " \;<a href=\"post.php?id=$id\" title=\"Read Full Post\">Full...</a>";
}
echo "</p>";
echo "</div>";
}
?>
</div><!--content-->
<div id="left">
<h6>Recent Gallery</h6>
<div id="recent_gallery">
</div><!--recent_gallery-->
<h6>Other Web Folk</h6>
<ul>
<li><a href="http://www.theflashblog.com" title="The Flash Blog">The Flash Blog</a></li>
<li><a href="http://www.gotoandlearn.com" title="Go to and learn">GotoAndLearn</a></li>
<li><a href="http://www.kirupa.com" title="Kirupa">Kirupa</a></li>
<li><a href="http://www.thefwa.com/" title="The Favorite Website Awards">The FWA</a></li>
<li><a href="http://websitedesignawards.com/" title="Website Design Awards">The WDA</a></li>
</ul>
</div><!--left-->
</div><!--wrapper-->
</body>
</html>
i have the file saved as index.php
with out the php and the file saved as .html the css works fine with no problems
thanks for any help.
Jake
<?php
require('php/db_connect.php');
$sql = "SELECT id, title, date, content FROM jchamb_blog ORDER BY date DESC LIMIT 3 ";
$result = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JChamb Designs</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="header_info">
<h1>JChamb</h1>
<h3>Hi, I'm a Mac.</h3>
</div><!--header_info-->
<div id="banner"> </div>
<div id="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Who</a></li>
<li><a href="#">Work</a></li>
<li><a href="#">Archive</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Links</a></li>
</ul>
</div><!--nav-->
<div id="content">
<h6>Who?</h6>
<p> Jake Chamberlain be the name, and design would so happen to be the game! I like lots of things including Apple, Flash, and Hambuger Helper. I find myself addicted to Mac Rumors, and CNN. I can somtimes spend hours if not days without seeing sun light. <a href="#" title="Full Bio">Full...</a></p>
<br />
<h6>Recent Posts</h6>
<?php
while($row = mysql_fetch_assoc($result)) {
$id = $row['id'];
$title = $row['title'];
$date = $row['date'];
$content = substr($row['content'],0, 500);
echo "<div class=\"post\">";
echo "<hr />";
echo "<span class=\"titles\">$title</span>";
echo "<span class=\"dates\">$date</span>";
echo "<p class=\"content\"> $content";
if(strlen($content) > 500) {
echo " \;<a href=\"post.php?id=$id\" title=\"Read Full Post\">Full...</a>";
}
echo "</p>";
echo "</div>";
}
?>
</div><!--content-->
<div id="left">
<h6>Recent Gallery</h6>
<div id="recent_gallery">
</div><!--recent_gallery-->
<h6>Other Web Folk</h6>
<ul>
<li><a href="http://www.theflashblog.com" title="The Flash Blog">The Flash Blog</a></li>
<li><a href="http://www.gotoandlearn.com" title="Go to and learn">GotoAndLearn</a></li>
<li><a href="http://www.kirupa.com" title="Kirupa">Kirupa</a></li>
<li><a href="http://www.thefwa.com/" title="The Favorite Website Awards">The FWA</a></li>
<li><a href="http://websitedesignawards.com/" title="Website Design Awards">The WDA</a></li>
</ul>
</div><!--left-->
</div><!--wrapper-->
</body>
</html>
i have the file saved as index.php
with out the php and the file saved as .html the css works fine with no problems
thanks for any help.
Jake