Small php includes problem

Discussion in 'PHP' started by whateverandever2, Jul 23, 2006.

  1. #1
    I have got a design that uses php includes, on the top file which has my header and a google banner it keeps coming up with this error when checking for errors.

    'Line 11 column 78: document type does not allow element "TABLE" here.'

    The code is

    <style type="text/css">
    /*<![CDATA[*/
     body {
      background-color: #242424;
     }
     div.c3 {text-align: right}
     td.c2 {border: 1px solid #5f5f5f;border-top-width:0px;border-left-width:0px;border-right-width:0px;}
     td.c1 {border: 1px dotted #000000}
    /*]]>*/
    </style>
      <table width="800" border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
          <td colspan="9"><img src="images/layout_01.gif" width="800" height="143" alt="" /></td>
        </tr>
    
        <tr>
          <td colspan="9"><img src="images/layout_10.gif" width="800" height="2" alt="" /></td>
        </tr>
    
        <tr>
          <td colspan="9"><img src="images/layout_11.gif" width="800" height="1" alt="" /></td>
        </tr>
    
        <tr>
          <td colspan="9" bgcolor="#ABABAB">
            <table cellpadding="3" cellspacing="0" width="100%">
              <tr>
                <td align="center">
        <script type="text/javascript"><!--
    google_ad_client = "pub-8178224563442432";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_type = "text";
    google_ad_channel ="";
    google_color_border = "ABABAB";
    google_color_bg = "ABABAB";
    google_color_link = "FFFFFF";
    google_color_text = "FFFFFF";
    google_color_url = "FFFFFF";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>          </td>
              </tr>
            </table>
    
            <table cellpadding="0" cellspacing="5" width="100%">
    
              <tr>          </tr>
            </table>
            </td>
    
    
    
    
        <tr>
          <td><img src="images/spacer.gif" width="81" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="77" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="27" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="80" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="109" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="107" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="112" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="86" height="1" alt="" /></td>
    
          <td><img src="images/spacer.gif" width="121" height="1" alt="" /></td>
        </tr>
      </table>
    Code (markup):
    Obviously as its just a include I got told not to include head and body and stuff, the line in question is the

      <table width="800" border="0" cellpadding="0" cellspacing="0" align="center">
    Code (markup):
    Any ideas pls? Thnx
     
    whateverandever2, Jul 23, 2006 IP
  2. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #2
    I believe it has something to do with the fact that the style is supposed to be within the <head> </head> . In one of my websites I have part of the head inside my header.php include and have never had any problems or errors as a result of it.
     
    kentuckyslone, Jul 23, 2006 IP
  3. whateverandever2

    whateverandever2 Peon

    Messages:
    881
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hmm, I got told not to do that on an include as if a <head> is in the include and in the main file then you are gonna have two <heads> ?
     
    whateverandever2, Jul 23, 2006 IP
  4. rosytoes

    rosytoes Peon

    Messages:
    230
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    do you already have a <head> in front of the <style>? is a just a case of a missing </head> between the </style> and <table>?
     
    rosytoes, Jul 23, 2006 IP
  5. whateverandever2

    whateverandever2 Peon

    Messages:
    881
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Not on the include no as I have a <head> tag on the main index, so if I put one in the include then surely I'd have two <head> tags showing up?
     
    whateverandever2, Jul 23, 2006 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    If your include statement lies in the head, table is not allowed. If the include is in the body, style is not allowed. So, you cannot have the snippet as you have it.

    cheers,

    gary
     
    kk5st, Jul 23, 2006 IP
  7. whateverandever2

    whateverandever2 Peon

    Messages:
    881
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hmm, but if I take the table out then it messes up the whole design?
     
    whateverandever2, Jul 23, 2006 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    You don't need to take it out, you need to put it in the proper place. A link (preferred) or the full source would be helpful. Please indicate where the include statement lives.

    cheers,

    gary
     
    kk5st, Jul 23, 2006 IP
  9. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #9
    No you cannot have two heads. Thats not what I was implying. the head can only be in one place, BUT the style must be within the head.
     
    kentuckyslone, Jul 26, 2006 IP