SitePoint Sponsor

User Tag List

Results 1 to 25 of 28

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Will this DOCTYPE and meta data code be non-problematic for several years?

    I want to put up hundreds of html pages and I don't want to have to make changes to the xhtml for several years.
    The pages I created using the code shown pass W3C. I have used the word "example" in places in the code
    to keep out extraneous info (just for this post).

    Is the code below adequate or in need of extra meta-data, other info, or changes?


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>example</title>
    <meta name="keywords" content="example" />
    <meta name="description" content="example" />
    <link rel="stylesheet" type="text/css" href="example.css" />
    </head>

  2. #2
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    Is there a particular reason you're not going with a strict DOCTYPE?

    The code is technically OK, but I'd put that into a PHP (or any other programming language) include so that you only ever need to edit a single file instead of a hundred or more, should the need arise.

    Example (with your code):

    header.html

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>example</title>
    <meta name="keywords" content="example" /> 
    <meta name="description" content="example" /> 
    <link rel=
    "stylesheet" type="text/css" href="example.css" />
    </head>

    And in your index.php (or any other language):
    PHP Code:
    // Include header HTML document into index.php
    <?php
    include('header.html');
    ?>
    Maleika E. A. | Rockatee | Twitter | Dribbble



  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reason for not making the DOCTYPE strict is my concern that a strict doctype would not be "compatible" with older browsers.

    Is this a possibility or reason for concern?

    I will be learning PHP as well as Javascript in the next few months. For the time being I wanted to make some base pages to be found by search engines.

  4. #4
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    Using a strict DOCTYPE won't cause any issues with older browsers, HTML4.01 strict won't even cause problems with messy markup. If you code your HTML document properly, no hiccups can occur, so if that is accounted for then you're absolutely safe using a strict DOCTYPE. It's the way to go. I'd also recommend going with HTML 4.01 strict as that is the current standard (rather than using any flavors of XHTML).
    Maleika E. A. | Rockatee | Twitter | Dribbble



  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Kohoutek. I will use this:

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

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quick follow up, if I use the above post Strict code should I delete the extra code other than HTML in this line I originally had? --


    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    Last edited by Deinonychus; Oct 18, 2011 at 16:21. Reason: left out info

  7. #7
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    That attribute needs to go as you're using HTML, so something like this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Add Ttitle</title>
        <meta name="description" content=""">
        <meta name="keywords" content="">
        <meta name="author" content="">
        <link rel="stylesheet" href="/css/main.css" media="screen">
        <link rel="stylesheet" href="/css/print.css" media="print">
        <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/favicon.ico">
      </head>
    Maleika E. A. | Rockatee | Twitter | Dribbble



  8. #8
    SitePoint Enthusiast
    Join Date
    Sep 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Kohoutek. I will use that as a guideline.

  9. #9
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    I had actually guessed he made that typo deliberately but didn't want to let the cat out. The prior sentences gave a big hint. ;-)


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
  •