Tech Support Guy banner
Status
Not open for further replies.
1 - 15 of 15 Posts

·
Registered
Joined
·
7 Posts
Discussion Starter · #1 ·
Can someone help me out.
I don't understand the Doc Type.
Is this standard procedure to include in each page or just
the index?

Please help, I want to be able to validate my site.
 

·
Registered
Joined
·
2,636 Posts
You need it on every page.

It tells the browser what dtd file to download and use for rendering the page.

The dtd file defines the document type, which is more or less the version of html that you will use on the page. The dtd file defines the allowed elements, attributes, data types and their default values/behaviors.

Also, for browsers that support doctype switching, a proper doctype will tell the browser to use Standards Mode to render pages (which is what you want and basically follows behavior laid out in the specification of the doctype in question.). Without a proper doctype, the browser will use Quirks mode and can cause goofy behavior, but can also sometimes correct buggy code. Your code should not have any bugs though.

The doctype is also used for xhtml/html validators like the W3C validator, so it can properly check your code for errors.

Here's a list of doctypes you can use.
http://www.w3.org/QA/2002/04/valid-dtd-list.html

You also need to specify a character encoding.

At this time, you should be focusing on XHTML 1.0 Strict.

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

        XHTML 1.0 Strict served as text/html

        Some content
 

·
Registered
Joined
·
7 Posts
Discussion Starter · #4 ·
Thanks so much for responding.

You are saying on each one?

Why is the Validation Site included?

I'm just learning how to do the basics.

I think, what you suggested would be a few steps ahead :rolleyes:
All thou, I plan on advancing my skills.
Why not XML next? I thought this was the
second up the ladder.
:confused:
 

·
Registered
Joined
·
3,012 Posts
angeni said:
Thanks so much for responding.

You are saying on each one?

Why is the Validation Site included?

I'm just learning how to do the basics.

I think, what you suggested would be a few steps ahead :rolleyes:
All thou, I plan on advancing my skills.
Why not XML next? I thought this was the
second up the ladder.
:confused:
XHTML is a XML application.
So you are using XML.

~~~~~~~

If your host allows SSI (and your pages have .shtml extensions), then you can just put the doctype in a text file, and just include it in the others as the first line.

Example:



-OR-

If your host has PHP (and your pages have .php extensions), then you can put the doctype in a php file, and just include it in the others as the first line.

Example:

<?php include("yourfilename.php"); ?>
 

·
Registered
Joined
·
7 Posts
Discussion Starter · #6 ·
I'm using HTML code.
The XML is advanced to me.
It just seems like it would be

Thanks for getting back to me.
 

·
Registered
Joined
·
3,012 Posts
angeni said:
I'm using HTML code.
The XML is advanced to me.
It just seems like it would be

Thanks for getting back to me.
There's only a few minor differences between the two.
(and you'll probably only notice if you use the Strict doctype)

is now

is now

<img> is now <img />
is now

Bacally, all empty tags now have to be self-closed.

Also, you can't just write this is a sentance. It has to be wrapped in a structured tag.


this is a sentance.

or this is a sentance. etc.

Also, everything is lowercase.

Example: This is Bold now becomes This is Bold

And you can't mix-up the closing tags.

Example:
This is bold and italic is wrong
This is bold and italic is right

The rest, you'll pick up as soon as you try to validate and read any errors on the W3C validator page. They usually tell you what's wrong and how to correct it (but in very vage and general terms)
 

·
Registered
Joined
·
7 Posts
Discussion Starter · #8 ·
Thanks for taking the time to help me understand XML
Its sounds easier now.
 

·
Registered
Joined
·
2,636 Posts
angeni said:
Thanks so much for responding.

You are saying on each one?

Why is the Validation Site included?

I'm just learning how to do the basics.

I think, what you suggested would be a few steps ahead :rolleyes:
All thou, I plan on advancing my skills.
Why not XML next? I thought this was the
second up the ladder.
:confused:
You need to include a doctype on every page regardless of your skill level.

XHTML is xml-based, but you'll be serving it as text/html. In other words, I'm saying you should start out with modern html, which would be xhtml 1.0 strict served as text/html. (text/html is associated with the .html and .htm extensions on most servers. .xhtml is associated with application/xhtml+xml on most servers)

namenotfound already explained some of the differences between ancient html and xhtml.

It would actually be better to start off using xhtml 1.0 served as application/xhtml+xml. That way, the browser uses it's xml parser to render the page and if there is even one error, the page won't render past that error. However, you are most likely testing your pages with Internet Explorer, which isn't advanced enough to support application/xhtml+xml. Either way, you need to test your pages in other browsers too. at least www.opera.com and www.mozilla.org

Don't be overwelmed by anything, just take your time. No one expects you to get it all right away. :up:
 

·
Registered
Joined
·
7 Posts
Discussion Starter · #10 ·
Thanks for your help,

Use the Doc Type on everypage.
This is even if its HTML skilled?

The xhtml 1.0 strict served is text/html, this is the DOC TYPE?

I'm not understanding. Are you saying, even If I'm using HTML for starting base. Still include the above Doc Type. with the HTML? :rolleyes: :eek: :rolleyes:

Sorry, I'm just a Newbie
 

·
Registered
Joined
·
14,681 Posts
The doctype posted was for XHTML. If you're using regular HTML, you'll want one of these doctypes.

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

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

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

"text/html" is the content-type.
 

·
Registered
Joined
·
7 Posts
Discussion Starter · #12 ·
I have used one of these, going with transitional.

Can you please let me know if its ok.

I don't know why there are so many to choose from.

I'm thinking transitional is a more flexible DOC TYPE?
 

·
Registered
Joined
·
7 Posts
Discussion Starter · #14 ·
That was fast........

Not sure if I will need this in the near future?
Frame Set? I could always change it? :cool:
 
1 - 15 of 15 Posts
Status
Not open for further replies.
Top