WordPress.org

Ready to get started?Download WordPress

Forums

Tracking Down an HTML Error (12 posts)

  1. Sphyr
    Member
    Posted 8 years ago #

    Sigh. I'm such a novice.

    I cut and pasted from an old template into my WordPress 1.5.2 installation. Looked like it was working fine. Deleted old unnecessary backups.

    Looks like my page doesn't validate. I didn't realize for some time because I was using ad-blocking software, set to "ignore errors". I disabled it the other day, and voila, html errors.

    I've tracked it down to something in my sidebar; I suspect I either have a missing or an extra [li] tag someplace.

    Would somebody with a fresh pair of eyes glance at it and see if my error is in an obvious spot? I haven't been able to find it. :(

    http://chasingthewind.net

  2. Mark Bloomfield
    Member
    Posted 8 years ago #

    hey there...

    1) i can spot a missing <ul> here:

    <!-- End Theme Switcher -->
    <li></li>
    <li class="pagenav"><h2>Pages</h2><ul><li class="page_item">

    2) another missing <ul> before this <li>:

    <li id="calendar"><table id="wp-calendar">

    try that and see if you're still getting errors...

  3. Sphyr
    Member
    Posted 8 years ago #

    Didn't work. :(

    I think the [ul] for those are up top at the [div id="sidebar"]. I re-counted, re-paired all the li's and ul's in the sidebar.php and they all seem to close, but it still doesn't validate.

  4. tomhanna
    Member
    Posted 8 years ago #

    You have 111 errors, not 1.

    http://validator.w3.org/check?uri=http%3A%2F%2Fchasingthewind.net%2F

    Looks like you have some unclosed <p> tags and your unclosed <li> tags are in posts. If you remember to hit the "Close Tags" quicktag before posting, you can eliminate some of that. Are you entering those tags manually? WordPress normally closes them when it inserts them.

  5. Sphyr
    Member
    Posted 8 years ago #

    Er, thanks, but that's not quite it. I'm convinced the 111 errors are actually 1 misplaced error in the sidebar. Most of those 111 errors occur within the posts on the front page, yet if I switch to the default WordPress Kubrick theme, all the posts validate with no errors.

  6. tomhanna
    Member
    Posted 8 years ago #

    Actually most of the errors are fairly simple things that have nothing to do with the lists. You have a lot of border=0 that should be border="0", for example. If you fix those, it will be easier to track down the real problem.

    I cut and pasted just the code from your sidebar in the validator.w3.org "Validate by Direct Input" and while it had 50 errors, they were none of them related to <li> or <ul> tags. They were almost entirely things like unescaped ampersands in javascripts and things related to the use of tables.

  7. tomhanna
    Member
    Posted 8 years ago #

    nevermind.

  8. Sphyr
    Member
    Posted 8 years ago #

    How do you "paste the code from my sidebar?" That validator doesn't work on php files.

  9. tomhanna
    Member
    Posted 8 years ago #

    I don't have your php file. The php file outputs HTML, which is what the browsers actually read and also what any validator that you input your URL into is going to see. Or if you click that "Valid XHTML" link on your blog, the validator will see the HTML that your server outputs, not the raw PHP file. I just did view page source, copy, paste.

  10. Validate the whole page, not just your sidebar. It won't correctly determine the document type if you just do partial HTML.

    Anyway, just use the W3 Validator that was linked to above and do as it suggests.

  11. tomhanna
    Member
    Posted 8 years ago #

    ViperBond,Sphyr convinced the error is in his sidebar and is an error related to a misplaced list tag of some sort. Sphyr won't even look at the multiple errors elsewhere on the page, which is why I did the validation separately for just the sidebar. But ultimately the solution is to go through and fix the simple things like border=0 instead of border="0" in the whole page and get the list down to a manageable size.

    And the validator offers the option to specify the document type.

  12. tomhanna
    Member
    Posted 8 years ago #

    Sphyr - if you can change two things it will cut your errors down to 36.

    In your Header template file change this:

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

    to

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">

    And change this:

    <html xmlns="http://www.w3.org/1999/xhtml">

    to this:

    <html>

Topic Closed

This topic has been closed to new replies.

About this Topic