SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: Page Type

  1. #1
    SitePoint Addict swaraj_here's Avatar
    Join Date
    Jan 2007
    Location
    India
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Page Type

    Hello all,

    I have been in web designing for last few years. But still I am not able to get by heart this line.

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


    Can any body has trick to remember?

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On around 99&#37; of pages using an xhtml dtd such as the one above, the page itself is sent as 'text/html' meaning you're not utilizing the benefits of HTML. The DTD only serves to remind the browser to render the page in standards mode.

    Some text editors can make a blank html page with an auto DTD and such - for VIM I have a special function which makes an html page with a dtd, blank script element and body.

    I would advise you to not use that dtd and go instead with an Html 5 dtd:

    Code:
    <!doctype html>
    Or HTML 4 strict:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    The trick though, is that the only difference between them is the part after "//W3C//DTD" and the URL to the .dtd file ( which isnt really parsed at all ).
    Cross browser css bugs

    Dan Schulz you will be missed

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Unless you have a specific reason to use a different DTD you should be using the HTML 4.01 strict DTD as that is the current standard for web pages.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by swaraj_here View Post
    Hello all,

    I have been in web designing for last few years. But still I am not able to get by heart this line.

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

    Can any body has trick to remember?
    Stick it in a text file and use copy and paste.
    Ed Seedhouse

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by swaraj_here View Post
    Can any body has trick to remember?
    I keep a basic HTML template in a very easy to access location on all my computers. The template has a doctype declaration, the required elements to validate against that docytype, a meta element to declare character encoding, and a lang attribute on the html element to declare the human language.

    When I need to create a new document, I just make a quick copy of that file and get started.

    However, good luck if you decide to memorize it

    Quote Originally Posted by SoulScratch View Post
    The DTD only serves to remind the browser to render the page in standards mode.
    The doctype declaration also tells most validation services what type of markup you're using. If you change it, you'll also have to adhere to different markup rules if you like to validate your pages.

  6. #6
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    With Windows, you can create an HTML template, which you can then access from the right-click menu. I assume you can do something similar with other systems.
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  7. #7
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,724
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by swaraj_here View Post
    Hello all,

    I have been in web designing for last few years. But still I am not able to get by heart this line.

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


    Can any body has trick to remember?
    Me? No. It's kinda hard to remember something that long. Remember the 4 parts to a DTD.

    !DOCTYPE-The identifier. It indicates to the user-agent that the enclosed information will define the type of document of the page.
    HTML-The Top Element. This tells the browser what element to expect as the top-level element. For HTML and XHTML documents this element would be <html>

    PUBLIC-The Availability. The most common DOCTYPES you will use will be publicly available - "PUBLIC". But you can also specify a local DTD with the "SYSTEM" key word.

    "-//W3C//DTD HTML 4.01 Transitional//EN"-The Formal Public Identifier. This entire string is what identifies the DOCTYPE.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Since that line always has that exact value there is no need to remember it, just copy it from one page to the next along with the rest of your template code.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Since that line always has that exact value there is no need to remember it, just copy it from one page to the next along with the rest of your template code.
    That's pretty much what I do. Though I have complete HTML/CSS wireframes that I use to start.

  10. #10
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by swaraj_here View Post
    Hello all,

    I have been in web designing for last few years. But still I am not able to get by heart this line.

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


    Can any body has trick to remember?
    Copy and paste as the others have said.

    Unless you are using real xhtml, I would use the HTML 4.01 strict DTD.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">

    Here are some good links to help you with your decision:
    http://www.sitepoint.com/forums/showthread.php?t=393445
    http://www.sitepoint.com/forums/showthread.php?t=428205

  11. #11
    Non-Member
    Join Date
    Oct 2008
    Location
    Banned
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I do in PHP is include one file that contains all the variables and constants for my entire site. Then after I include the file with PHP I just echo the doctype variable and BAM. The doctype is included in the page and can be included in every page. Must easier IMO. If you ever want to change the doctype then just edit that one variable and the entire site changes.

    Cheers

  12. #12
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Why just the DOCTYPE? I rarely need to change anything above the <body> tag, except the title, so I make a simple template file and load the title into this. Depending the the design, I can usually even get away with including even more in the header. Most of my headers are something like this:

    Code php:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     
    <html>
     <head>
      <title><?php echo $title;?></title>
     
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     
      <link rel="stylesheet" href="screen.css" type="text/css" media="screen">
      <link rel="stylesheet" href="print.css" type="text/css" media="print">
     </head>
     <body>
      <div id="contents">
       <h1><?php echo $title;?></h1>
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  13. #13
    Non-Member
    Join Date
    Oct 2008
    Location
    Banned
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was simply making an example...You can of course do that but most times I have to change the title variable so much that it is so much more useful to do what I want.

    :/

  14. #14
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Christian:
    Each of my pages not only have a different title, they have a different description meta tag, and pages with submit forms (are supposed to) have the no-cache, no-store tags.
    Also, some of them have different CSS references depending on what I'm doing. If I have a light-dark selection for users, then the back-end language will have to replace the CSS link in the head. Also my one-off pages which have their own internal CSS have different heads (pages where there's no point in having 2 GET requests when the CSS is only for that particular page, such as my hover maps-- the specificity gets too crazy to lump them into the regular CSS).

    And, on one set of sites, the Doctype isn't even the same-- to get around caching problems re forms, I was forced to use target="blank" on some in-form links. So those pages get a transitional doctype while I'd rather the rest of my pages get the Strict one.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •