Far Cry Posted November 27, 2010 Share Posted November 27, 2010 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 https://forums.phpfreaks.com/topic/219956-div-issues/ Share on other sites More sharing options...
haku Posted November 27, 2010 Share Posted November 27, 2010 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 https://forums.phpfreaks.com/topic/219956-div-issues/#findComment-1140164 Share on other sites More sharing options...
doddsey_65 Posted November 27, 2010 Share Posted November 27, 2010 also by using a text editor such as notepad++ it makes things like this easier as when you select <div> it highlights it and the ending div so you know where it closes. This makes it easier to see which one is missing. Link to comment https://forums.phpfreaks.com/topic/219956-div-issues/#findComment-1140241 Share on other sites More sharing options...
arbitter Posted November 27, 2010 Share Posted November 27, 2010 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 https://forums.phpfreaks.com/topic/219956-div-issues/#findComment-1140250 Share on other sites More sharing options...
mikhl Posted December 12, 2010 Share Posted December 12, 2010 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 https://forums.phpfreaks.com/topic/219956-div-issues/#findComment-1146111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.