Jump to content

Div issues


Far Cry

Recommended Posts

I know that I am missing a div somewhere just cant find out where...

<?php
session_start();
$username = $_SESSION['username'];
$userid = $_SESSION['userid'];
?>
<?php require'scripts/connect.php';?>

<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Coding Experiments</title>
<meta name='Keywords' content='' />
<meta name='robots' content='' />
<meta name='Description' content='' />
<meta name='Author' content='' />
<link href='css/layout.css' rel='stylesheet' type='text/css' />
<link href='css/slider.css'rel='stylesheet' type='text/css' />
<script type='text/javascript' src='js/jquery-1.2.6.min.js'></script>
<script type='text/javascript' src='js/jquery-easing-1.3.pack.js'></script>
<script type='text/javascript' src='js/jquery-easing-compatibility.1.2.pack.js'></script>
<script type='text/javascript' src='js/coda-slider.1.1.1.pack.js'></script>
<script type=:'text/javascript' src='js/javascript.js'></script>

<script type='text/javascript'>

	var theInt = null;
	var $crosslink, $navthumb;
	var curclicked = 0;

	theInterval = function(cur){
		clearInterval(theInt);

		if( typeof cur != 'undefined' )
			curclicked = cur;

		$crosslink.removeClass('active-thumb');
		$navthumb.eq(curclicked).parent().addClass('active-thumb');
			$('.stripNav ul li a').eq(curclicked).trigger('click');

		theInt = setInterval(function(){
			$crosslink.removeClass('active-thumb');
			$navthumb.eq(curclicked).parent().addClass('active-thumb');
			$('.stripNav ul li a').eq(curclicked).trigger('click');
			curclicked++;
			if( 5 == curclicked )
				curclicked = 0;

		}, 3000);
	};

	$(function(){

		$('#main-photo-slider').codaSlider();

		$navthumb = $('.nav-thumb');
		$crosslink = $('.cross-link');

		$navthumb
		.click(function() {
			var $this = $(this);
			theInterval($this.parent().attr('href').slice(1) - 1);
			return false;
		});

		theInterval();
	});
</script>

</head>
<body >

<div id='status' align='right'><?php require('scripts/status.php'); ?></div>
<div id='wrap'>
<div id='header'>
<h1 id='sitename'>Coding Experiments<span id='description'>Anything is possible...</span></h1>
<div id='topnav'>
<?php
if($username){
echo"<ul>";
echo"<li><a href='index.php'>Home</a></li>";
echo"<li><a href='#'>Projects</a></li>";
echo"<li><a href='#'>Download</a></li>";
$sql = ("SELECT COUNT(message_id) AS count FROM messages WHERE to_user='$username' AND message_read='0'") or trigger_error('Error: ' . 

mysql_error());
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$count = $row['count']; 
echo"<li><a href='inbox.php'>Inbox($count)</a></li>";
echo"<li><a href='#'>Profile</a></li>";
echo"<li><a href='#'>Account</a></li>";
echo"<li><a href='logout.php'>Logout</a></li>";



echo"</ul>";
}

  else 
{
echo"<ul>";
echo"<li><a href='index.php'>Home</a></li>";
echo"<li><a href='#'>Projects</a></li>";
echo"<li><a href='#'>Download</a></li>";
echo"<li><a href='register.php'>Register</a></li>";
echo"<li><a href='login.php'>Login</a></li>";
echo"<li><a href='#'>Contact</a></li>";

	 }
?>
</div>
<div class='clear'></div>
<div id='headercolumn1'>
<p class='description'></p>
</div>

<div id='headercolumn2'>
<?php /*<div id='search_top'>
<form action='/search/search.php' method='get'>
<p><input type='text' name='query' id='query' class='keyword'/>	</p>
<p class='button'><input name='' type='image' src='images/searchbutton.gif' alt='Search' /></p>
<p class='hide'>	<input type='hidden' name='search' value='1' /> </p>

</form>
</div>
<div id='subscribe'><a href='#'>Subscribe</a></div>
*/
?>
</div>

<div class='clear'></div>

</div>

<div id='contents'>
<div id='topbar'>
<?php
$query = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 1") or trigger_error('Error: ' . 

mysql_error());
		$numrows = mysql_num_rows($query);
		if ($numrows > 0){

			while ($row = mysql_fetch_assoc($query)){
				$title = $row['title'];
				$content = nl2br($row['content']);
                    $date = $row['date'];
				$by = $row['by'];

				echo"<center><font color='#FFFFFF'><h2>$title</h2></font><br>";
				echo"<font color='#FFFFFF'><p>$content</p></font><br><br><br></center>";
				echo"                                                                                                                                                                                              <b><font color='#FFFFFF'>Posted By: $by </font></b><br>";
				echo"                                                                                                                                                                            <b><font color='#FFFFFF' size='-4'> $date </font></b>";
				echo"<div align='left'>  <a href='news.php' target='_blank'><b>View More...</b></a></div>";
			}
		}



else
    echo"<h2>No news found!</h2>";

?>

<div class='clear'></div>
</div>
</div>
</div>

Link to comment
Share on other sites

Problems like this are best fixed by formatting your code in a clean easy to read manner. I indent pretty much every child element. For example:

 

<div>
  <ul>
    <li>
      <ul>
        <li>something</li>
      </ul>
   </li>
  </ul>
  <p>some text</p>
  <div>
    <h2>Header</h2>
  </div>
</div>

This way if anything is missing, it's quite easy to see.

Link to comment
Share on other sites

In your <ul> in your else, you don't close the <ul>.

 

for the rest, I can't spot it either.

Here's your code a little more clear, still missing a </ul>

<div id='status' align='right'>
<?php require('scripts/status.php'); ?>
</div>
<div id='wrap'>
<div id='header'>
	<h1 id='sitename'>Coding Experiments<span id='description'>Anything is possible...</span></h1>
	<div id='topnav'>
		<?php
		if($username){
			echo"<ul>";
				echo"<li><a href='index.php'>Home</a></li>";
				echo"<li><a href='#'>Projects</a></li>";
				echo"<li><a href='#'>Download</a></li>";
				$sql = ("SELECT COUNT(message_id) AS count FROM messages WHERE to_user='$username' AND message_read='0'") or trigger_error('Error: ' . 
				mysql_error());
				$result = mysql_query($sql);
				$row = mysql_fetch_assoc($result);
				$count = $row['count']; 
				echo"<li><a href='inbox.php'>Inbox($count)</a></li>";
				echo"<li><a href='#'>Profile</a></li>";
				echo"<li><a href='#'>Account</a></li>";
				echo"<li><a href='logout.php'>Logout</a></li>";
			echo"</ul>";
		}
		else {
			echo"<ul>";
				echo"<li><a href='index.php'>Home</a></li>";
				echo"<li><a href='#'>Projects</a></li>";
				echo"<li><a href='#'>Download</a></li>";
				echo"<li><a href='register.php'>Register</a></li>";
				echo"<li><a href='login.php'>Login</a></li>";
				echo"<li><a href='#'>Contact</a></li>";
		}
		?>
	</div>
	<div class='clear'>
		 
	</div>
	<div id='headercolumn1'>
		<p class='description'></p>
	</div>
	<div id='headercolumn2'>
		 
	</div>
	<div class='clear'>
		 
	</div>
</div>
<div id='contents'>
	<div id='topbar'>
		<?php
		$query = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 1") or trigger_error('Error: ' . 
		mysql_error());
		$numrows = mysql_num_rows($query);
		if ($numrows > 0){

			while ($row = mysql_fetch_assoc($query)){
				$title = $row['title'];
				$content = nl2br($row['content']);
                    $date = $row['date'];
				$by = $row['by'];

				echo"<center><font color='#FFFFFF'><h2>$title</h2></font><br>";
				echo"<font color='#FFFFFF'><p>$content</p></font><br><br><br></center>";
				echo"                                                                                                                                                                                              <b><font color='#FFFFFF'>Posted By: $by </font></b><br>";
				echo"                                                                                                                                                                            <b><font color='#FFFFFF' size='-4'> $date </font></b>";
				echo"<div align='left'>  <a href='news.php' target='_blank'><b>View More...</b></a></div>";
			}
		}
		else{
			echo"<h2>No news found!</h2>";
		}
		?>
		<div class='clear'>
			 
		</div>
	</div>
</div>
</div>

Link to comment
Share on other sites

  • 3 weeks later...

As stated, indenting is always a good idea. i also like to place html comments to show what the ending divs are, so like:

<div id="main">
     <p>This is content</p>
</div><!--end main-->

 

Sorry about not being able to help much on the actual problem

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.