More PHP Problems

Miscellaneous Forums/General Discussion/More PHP Problems

I'm trying to figure out why No Enemies.Com looks like someone shot the middle part of it:
http://www.noenemies.com

I've been working in PHP, and it seems as though it completely forgets about the content part of the page. The header also is completely ignored. I'm not sure what the problem is, but here's the code:
<?php
  include_once('header.html');
  $page_title='Home';
?>


<div id="nav1">
  <ul>
    <li><strong>home</strong></li>
    <li><a href="projects.php">projects</a></li>
    <li><a href="download.php">downloads</a></li>
    <li><a href="gallery.php">gallery</a></li>
    <li><a href="articles.php">articles</a></li>
    <li><a href="services.php">services</a></li>
    <li><a href="blogs.php">blogs</a></li>
  </ul>
</div>

<div id="main">
<div id="bigtitle"><h1>Updates...</h1></div>
<div id="sidetitle" align="right"><h1>More...</h1></div>

<div id="sidecontent" align="left">
<b>Updates</b>
<ul>
  <li>New website design</li>
  <li>Started new project: <a href="projects.php?id=plasma">Plasma FPS</a></li>
  <li>Created the <a href="/forum/index.php">No Enemies.Com Forums</a></li>
</ul>
<hr>
<b>Recent Blog Entries</b>
<ul>
  <li>Blog entry 1</li>
  <li>Blog entry 2</li>
  <li>Blog entry 3</li>
</ul>
<hr>
<b>Recent Articles</b>
<ul>
  <li>Article 1</li>
  <li>Article 2</li>
  <li>Article 3</li>
</ul>
<hr>
</div>

<div id="content">
<p><br><br><br><h2>About Us</h2></p>
<p>Welcome to No Enemies Development, previously known as No Enemies Games, and No Enemies.Com. No Enemies Development is a software development company creating mostly games, but sometimes we might output an application or a <a href="http://www.blitzbasic.com">Blitz3D</a> library sometimes. We also offer a selection of services that game developers might use. Take a look around, and you might find something interesting.</p>
<p><h2>News</h2></p>

<?php
$query = "SELECT title, content, DATE_FORMAT(date, '%M %d, %Y') AS date FROM news ORDER BY id DESC";
    $result = mysql_query($query);
    $first = TRUE;
	$num = 0;

    while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
	$num = $num + 1;
	   echo '<p><b> [ ';
	   echo $row['date'];
	   echo ' - ';
	   echo $row['title'];
           echo ' ]</p></b><p>';
	   echo $row['content'];
		if ($num == 5) {
			break;
		}
	   echo '</p>';

      $first = FALSE;
    }

if ($first) {
	echo '<i>No news added yet.</i>';
}
?>

</div>

</div>


<?php 
  include_once('footer.html');
?>


That's the code of "index.php." The header and footer files are below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
  <title>No Enemies.Com - <?php echo $page_title; ?></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="description" content="Steven Campbell's Domain - filled with resources, tutorials, downloads, humor, free software, services, and many other offers and rewards. Claim yours today! :D" />
  <meta name="keywords" content="Steven, Campbell, resources, reviews, blog, no, enemies, noenemies, downloads, software, opinion, austin, tx, services" />
  <meta name="author" content="Steven Campbell" />
  <link rel="stylesheet" type="text/css" href="main.css" />
</head>

<body><div class="container">

<?php
  include_once('mysql_connect.php');
?>

<div id="header"><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font size="6" color="white"><b>No Enemies.Com</b></font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size="2" color="#ccf"><b>Currently working on Plasma FPS</b></font>
</div>


And now the footer...

<hr />

<div id="nav2">
  <ul>
    <li><a href="about.php">about</a></li>
    <li><a href="contact.php">contact</a></li>
    <li><a href="links.php">links</a></li>
  </ul>
</div>

<div id="footer" align="center"
  <p>&copy; Copyright 2004-2005 Steven Campbell<br />
  All times are GMT -6 (USA Central)</p>
</div>

</div>

</body>

</html>

I'm not really sure what's wrong with it, but I think it has something to do with the inclusion lines: "include_once('header.html')" and "include_once('footer.html')." Any thoughts?

And I forgot the "main.css" file:
body {
  margin:.2in .75in;
  padding:0;
  font:small Verdana;
  background:#357 url("img/bg.gif");
  color:#fff;
  }

a, a:active, a:visited {
  color:#259;
  text-decoration:none;
  }

a:hover {
  color:#229;
  text-decoration:none;
  }

.container {
  background:#135;
  width:750px;
  margin:20px auto;
  border:solid #123;
  border-width:0 1px;
  text-align:left;
  color:#333;
  position:relative;
  }

#infobox {
  float:left;
  width:150px;
  background-color:#eee;
  color:#000;
  margin-top:4px;
  margin-right:6px;
  margin-left:6px;
  padding:1px 4px;
  background-repeat:no-repeat;
  font-size:85%;
  line-height:1.6em;
  border:1px dashed #135;
  text-align:justify;
  }

#bigtitle {
  position:relative;
  float:left;
  width:558px;
  background-color:#abb;
  color:#000;
  padding:1px 4px;
  background-repeat:no-repeat;
  font-size:85%;
  line-height:1.6em;
  border-top:0px solid #135;
  border-left:0px solid #135;
  border-right:0px solid #135;
  border-bottom:1px dashed #135;
  }

#bigtitle_noside {
  position:relative;
  float:left;
  width:742px;
  background-color:#abb;
  color:#000;
  padding:1px 4px;
  background-repeat:no-repeat;
  font-size:85%;
  line-height:1.6em;
  border-top:0px solid #135;
  border-left:0px solid #135;
  border-right:0px solid #135;
  border-bottom:1px dashed #135;
  }

#sidetitle {
  float:right;
  width:175px;
  background-color:#bcc;
  color:#000;
  padding:1px 4px;
  background-repeat:no-repeat;
  font-size:85%;
  line-height:1.6em;
  border:solid #135;
  border-top:0px solid #135;
  border-left:1px dashed #135;
  border-right:0px solid #135;
  border-bottom:1px dashed #135;
  }

#sidecontent {
  position:relative;
  float:right;
  width:175px;
  background-color:#eef;
  color:#000;
  padding:1px 4px 4px 4px;
  margin-left:5px;
  background-repeat:no-repeat;
  font-size:85%;
  line-height:1.6em;
  border:solid #135;
  border-top:0px solid #135;
  border-left:1px dashed #135;
  border-right:0px solid #135;
  border-bottom:1px dashed #135;
  text-align:justify;
  }

#sidecontent ul {
  padding:0px 0px 0px 14px;
  list-style-type:disc;
  }

#header {
  background-color:#000;
  background-repeat:no-repeat;
  background-image:url("img/header1.jpg");
  background-position:0 0;
  float:left;
  width:100%;
  height:80px;
  margin-top:3em;
  }

#nav1 {
  background-color:#135;
  float:left;
  width:100%;
  border:solid #135;
  border-width:1px 0;
  }

#nav1 a, #nav strong {
  background-color:#135;
  display:block;
  padding:5px 10px 6px;
  border:solid #135;
  border-width:0 1px 0 0;
  color:#68a;
  text-decoration:none;
  white-space:nowrap;
  }

#nav1 strong {
  display:block;
  padding:5px 10px 6px;
  color:#fff;
  font-weight:bold;
  background-color:#246;
  }

#nav1 a:hover {
  background-color:#123;
  color:#fff;
  border-right:#123 solid 1px;
  }

#nav1 ul {
  margin:0;
  padding:0 20px;
  list-style:none;
  font-size:85%;
  text-transform:lowercase;
  }

#nav1 li {
  float:left;
  margin:0;
  padding:0;
  background-image:none;
  line-height:normal;
  text-indent:0;
  }

#nav2 {
  background-color:#135;
  background-image:url("img/nav2.gif");
  background-repeat:repeat-x;
  background-position: 0px -5px;
  width:100%;
  padding:0;
  height:3em;
  position:absolute;
  top:0;
  left:0;
  text-decoration:none;
  }

#nav2 a {
  float:left;
  display:block;
  color:#479;
  margin-top:3px;
  padding:.25em 8px;
  border-width:0;
  font-size:85%;
  text-transform:lowercase;
  text-decoration:none;
  }

#nav2 a:hover {
  color:#bcd;
  text-decoration:none;
  }

#nav2 ul {
  margin:0;
  padding:1em 12px 0;
  list-style:none;
  }
#nav2 li {
  display:inline;
  margin:0;
  padding:0;
  background-image:none;
  line-height:1em;
  text-indent:0;
  }

#footer {
  background-color:#135;
  background-image:url("img/nav2.gif");
  background-repeat:repeat-x;
  background-position: 0px 0px;
  border-color:#123;
  color:#479;
  padding:4px 4px;
  }

#footer p {
  border-color:#124;
  color:#479;
  font-size:8pt
  }

#main {
  float:left;
  width:750px;
  background-color:#fff;
  position:relative;
  text-align:justify;
  }

#content {
  background-color:#fff;
  margin:4px 4px 4px 4px;
  padding:4px 4px 4px 4px;
  text-align:justify;
  }

h1, h2, h3 {
  margin:.5em 0 .5em;
  font-family:Trebuchet MS;
  font-weight:bold;
  clear:both;
  }
h1 {
  margin-top:.4em;
  font-size:180%;
  }
h2 {
  font-size:140%;
  }
h3 {
  font-size:125%;
  }



p {
  margin:0 0 .75em;
  line-height:1.3em;
  }
.imgleft {
  position:relative;
  float:left;
  margin:.4em 1em .4em 0;
  }
.imgright {
  position:relative;
  float:right;
  margin:.4em 0 .4em 1em;
  }
p.left img, p.right img {
  display:block;
  margin-bottom:.05in;
  border:.5pt solid silver;
  padding:.05in;
  }
p.left em, p.right em {
  display:block;
  margin-bottom:.05in;
  color:gray;
  }
.imgleft, .left, img.left {
  float:left;
  margin:.05in .1in .05in 0;
  }
.imgright, .right, img.right {
  float:right;
  margin:4px 0 4px 8px;
  }
img.imgleft, img.imgright {
  padding:4px;
  border:1px solid #ddc;
  }
img.block {
  display:block;
  margin:.5em 0;
  }
hr {
  background:gray;
  display:block;
  border-width:0;
  height:.25pt;
  }
th {
  text-align:left;
  font-weight:normal;
  }
code {
  font:110% Courier New;
  background-color:#eef;
  margin:0px 0px 4px 0px
  }


This is very odd. I made the files header.html, footer.html, index.php, main.css, and I saved all the images, and it works fine on my server: http://paulleduc.com/test/ (I changed nothing)
The only explanation would be that the files you have on your server are not the same as the ones you posted above...

EDIT: If you view the source on your server, you will find that it is showing what shold be shown, so it's just a matter of updating your files.

I found out the problem. When I included the database, I misspelt the database's name, and my code went straight to the "break;" tag, and everything else on the page wasn't included.

But now I'm having another problem, and it's not with PHP. It's with CSS. That little side column - I'm trying to make it so it's the height of the content section. I've tried "height: 100%" in the CSS, but that didn't work either. I'm trying to make it so it would be the height of the content section, and if it was any higher, then the content section would expand. Currently it just stays the same width. Here's the CSS:
#sidecontent {
  position:relative;
  float:right;
  width:175px;
  background-color:#eef;
  color:#000;
  padding:1px 4px 4px 4px;
  margin-left:5px;
  background-repeat:no-repeat;
  font-size:85%;
  line-height:1.6em;
  border:solid #135;
  border-top:0px solid #135;
  border-left:1px dashed #135;
  border-right:0px solid #135;
  border-bottom:1px dashed #135;
  text-align:justify;
  }


Any ideas?

I just want it to look like I've done it with tables.

I think it's a problem with CSS, but I'm not sure how to fix it, I just started using advanced CSS recently, and I'm not very fluent with it.

Is anyone familiar with CSS? I really need this problem fixed. My website has been down for days because of this sole problem.

Why don't you look at how Doug does it?

Basically the columns are faked. You don't add a colour to the background of the column as that will stop when the column stops (as you can see). What you do is add a background image to the main content. It only needs to be 5/10 pixels high, but the width should match the width of your content. You then colour it based on where you want the columns to be.

That's the background image I use on my site

Thanks for the tip. I'll try to do that, but then how would I align it in columns?

I modeled my site after that site. :)


I guessed :)

Remove the background and borders of the sidebar and then add the background image to your container class. The background image will automatically tile straight down giving you the impression that you have a two column layout.

Oh - and just to prove what I'm saying here is the image used for the columns on Stop Design

OK. I did that: http://www.noenemies.com

But whenever I add content to the "content" div, then it doesn't expand the site. It simply runs on past the footer. How do I fix this?

I've been working on it, and I haven't been so successful.

See on the under construction page: http://www.noenemies.com

The text that says "we apologize..." doesn't appear in the content box. I'm not sure why...

[edit]
Fixed it! Yes...now I can actually start working on the content, although I would like a better design. I hate my design skills...