Code Validation
My coding is bad. Real bad.
But I'm trying to fix things and learn how to do things right.
But I'm running into obstactles.
1) I used to use Netmechanic because it was more forgiving (less brutal). For some reason, all of my sites come up as not found even though they are indeed there. I don't get it. Since Netmechanic isn't working at all for my site, can anybody recommend another validator that is "forgiving" (to get started before w3.org gets the details)
2) So I moved on to http://validator.w3.org, fully knowing that it would kick my @ss with every little detail. Detail #1 was very important. The new template I'm working on (http://pstvalumni.com/pstv-template.php) didn't have any doctype yet. So I put in what it recommended:
Quote:
But to my surprise, that statement above came back with the error "This page is not Valid XHTML 1.0 Strict!" So why did they recommend it? What am I doing wrong at the beginning of my document? If that's not the doctype I should use, what is?
3. I don't want to get too far into my 150 errors but why do all of my META tags come up as errors (with errors inside the errors)?
Quicklink: http://validator.w3.org/check?uri=http%3A%2F%2Fpstvalumni.com%2Fpstv-template.php
Suzanne posted this at 16:06 — 24th April 2003.
She has: 5,507 posts
Joined: Feb 2000
Okay, pick the standard you're going to write to -- XHTML Strict 1.0 is pretty well the top of fully supported standards, and if you choose to go that route, you need to close all your tags, even the meta, br, hr, image, and link tags. To do this, you add a space and a forward slash before the closing angle bracket -- or
All tags need to be lowercase, and closed and some attributes are no longer valid in the HTML, but are in the CSS, so you should move them to the CSS files.
If you choose to use a lower standard, HTML 4.01 Loose is probably the best bet for you. But if you are able, give XHTML 1.0 Strict a shot. You CAN use tables for layout even in XHTML 1.0 Strict, but they may not work as you intend them to work without a bit of a learning curve for you and CSS, so you'll have to decide.
The DOCTYPE isn't what fits your code, it's what your code fits. i.e. it's the standard that your code is written to, it doesn't do anything other than tell browsers to render your page based on the set of rules in that standard (and the validator what rules to check your code against).
You'll find the errors will disappear quickly when you fix the major errors, as you can have cascading errors -- instead of 150, you may only have 50, but 100 of them are errors only because they are contained within something with an error.
Good luck!
fifeclub posted this at 15:20 — 25th April 2003.
He has: 688 posts
Joined: Feb 2001
Thanks. I gave it a shot with the transitional/loose and fixed what I could. I won't go thru all the errors but I have a few questions I don't understand to get me on the right path. Here's the new link http://validator.w3.org/check?uri=http://pstvalumni.com/pstv-template2.php
Line 19, column 27: there is no attribute "BACKGROUND"
I think I understand the explaination that background is a IE only tag (which I didn't think it was) but I need to use some IE specific tags. In this and similar cases, are there adjustments to the DOCTYPE that can specefy that I use attributes like "background" and "bordercolor"
Line 47, column 73: there is no attribute "ALT"
Right below this is the part of my code in question with a little red arrow pointing to where there is no "alt" tag..... but there is an "alt" tag right there. So why is it giving me this error saying that it's not there when it is?
Finally there are lots of errors referring to line 56. This is a code that is from pphlogger (logging). I don't know why but that's the code I need to use for that application. Does this mean that there's no way my code can ever validate (without removing my stat logging)?
Thanks for the guidance. By the way, I got the errors down from 150 to just a dozen.
andy206uk posted this at 15:58 — 25th April 2003.
He has: 1,758 posts
Joined: Jul 2002
the background attribute isnt supported in HTML 4. You should specify background images and colours in your stylesheet instead.
Suzanne posted this at 16:21 — 25th April 2003.
She has: 5,507 posts
Joined: Feb 2000
And alt is an attribute, but not for that element.
Suzanne posted this at 16:27 — 25th April 2003.
She has: 5,507 posts
Joined: Feb 2000
56: <noscript><img alt=""
src="http://www.mikesussman.com/pphlogger/pphlogger.php?
id=pstvalumni&st=js" /></noscript>
should be:
56: <noscript><img alt=""
src="http://www.mikesussman.com/pphlogger/pphlogger.php?
id=pstvalumni;st=js" /></noscript>
Also,
line 80:
80: <a href=/pstv-template2.php?subaction=showfull;
id=1051116651>Test</a>, by Mike Sussman
posted on 23 Apr 2003<br><a href="/pstv-template2.php?
subaction=showfull;
id=1051116604">The Sky Is Falling!</a>, by Mike Sussman
posted on 23 Apr 2003<br><a href="/pstv-template2.php?
subaction=showfull;
id=1051116555">The Sky Is Falling!</a>, by Mike Sussman
posted on 23 Apr 2003<br><a href="/pstv-template2.php?
subaction=showfull;
id=1046531293">Welcome to CuteNews v1.00</a>,
by CutePHP Team posted on 01 Mar 2003<br>
Or you can use & instead of & or ; alone. And don't forget to put quotes around your attribute values!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.