Avatar billede darrich Novice
16. oktober 2006 - 09:26 Der er 9 kommentarer og
1 løsning

W3C fejl: PHP index fil med include af htm

Hejsa

Da jeg gerne vil lave min hjemmeside så korrekt som muligt, så bruger jeg http://validator.w3.org/ til at checke siden, men jeg er stødt på et par ting, som jeg har brug for hjælp til.
Jeg har desuden lavet en særskilt css fil med formatering. Er ikke så erfaren med css, men man skal jo lære noget nyt ind i mellem.

Jeg får følgende fejl:

1:
Error Line 23 column 17: there is no attribute "LEFTMARGIN".
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">

2:
Error Line 23 column 31: there is no attribute "TOPMARGIN".
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">

3:
Error Line 23 column 47: there is no attribute "RIGHTMARGIN".
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">

4:
Error Line 23 column 64: there is no attribute "BOTTOMMARGIN".
...argin="0" topmargin="0" rightmargin="0" bottommargin="0">

5:
Error Line 26 column 27: there is no attribute "HEIGHT".
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">

6:
Error Line 48 column 82: required attribute "ALT" not specified.
...img src="\images\bannerTop.JPG"></td>

7:
Warning Line 99 column 148: cannot generate system identifier for general entity "oslashj".
...F&oslashj til fortrukne</a></td>

*serveren står til utf-8 og jeg har prøvet at sætte charset til iso-8859-1, men uden det virker, og så får jeg W3 fejl på det.

8:
*Vedrører det html dok som jeg includer*
Error Line 146 column 2: "DOCTYPE" declaration not allowed in instance.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

9:
*Vedrører det html dok som jeg includer*
Error Line 151 column 5: document type does not allow element "HTML" here.
<html>

*Skal både doctype, header, meta og alt andet slettes undtagen body? eller skal body markeringer også slettes?
og hvis jeg gør det kan google m.f. så indekserer siderne rigtigt?

Tak for hjælpen
Avatar billede keysersoze Ekspert
16. oktober 2006 - 10:11 #1
det er svært at vurdere uden at have set den kode der bliver genereret - men du må i hvert fald kun have én body. så har du body etc både i hoveddokumentet og i de der inkluderes er det en fejl.
Avatar billede olebole Juniormester
16. oktober 2006 - 11:00 #2
<ole>

Fejl 1-4 skyldes, at disse attributter ikke eksisterer i den markup-version, du benytter.
Fejl 5 skyldes, der aldrig har eksisteret en height-attribut på et tabel-element.
Fejl 6 skyldes, at du altid skal have en alt-attribut på et billed-element:
    <img src="fil.jpg" alt="en tekst">

Resten af fejlene må jeg se koden for at kunne finde  =)

/mvh
</bole>
Avatar billede darrich Novice
17. oktober 2006 - 09:31 #3
Hejsa og tak for i vil hjælpe

Fejl 1-4 hvilken markup version burde jeg så anvende? eller kan jeg erstatte det med CSS styles og hvordan?

Jeg har postede koden herunder bare ved brug af Vis koden på index.php.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--                                                                      -->
<!--              Copyright 2005 www.xxxx.dk                              -->
<!--              DO NOT COPY ANYTHING FROM THIS FILE                      -->

<html>
<head>
<title>xxxx | webdesign seo webreklame webkampagner</title>

<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<meta name="DESCRIPTION" content="xxxx - webdesign, seo, webreklame, webkampagner">
<meta name="Keywords" content="webdesign, hjemmesidedesign, webbureau, webreklame, webkampagner, programmering, hjemmesidedesign, seo">
<meta name="xxxx" content="2006">

<!--              Text and link style                                      -->
<link rel="stylesheet" href="/css/xxxxstylesheet.css" type="text/css">


</head>



<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">


<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
  <tr>
    <td align="center" valign="top">



      <table width="782" cellspacing="0" cellpadding="0" border="0">
        <tr>
          <td colspan="3" width="782" height="10"></td>
        </tr>
       
        <tr>
          <td colspan="3" width="782" height="100">


<!--              !!! Banner !!!                      -->         
            <table width="782" height="100" cellspacing="0" cellpadding="0" border="0">
              <tr>
                <td colspan="3" width="782" height="1" bgcolor="#000000"></td>
              </tr>
              <tr>
                <td width="1" height="98" bgcolor="#000000"></td>
                <td width="780" height="99"><img src="\images\xxxxComputerTop.JPG"></td>
                <td width="1" height="98" bgcolor="#000000"></td>
              </tr>
              <tr>
                <td colspan="3" width="782" height="1" bgcolor="#000000"></td>
              </tr>
            </table>
<!--              !!! Banner !!!end                      -->
         
          </td>
        </tr>
       
        <tr>
          <td colspan="3" width="782" height="10"></td>
        </tr>

       
        <tr>
          <td width="120" valign="top">

<!--              !!! Left menu !!!                      -->           
            <table width="120" cellspacing="0" cellpadding="0" border="0" >             
              <tr>
                <td><table width="120" cellspacing="0" cellpadding="0" border="0" bgcolor="#C9D4E2">
              <tr>
                <td colspan="5" width="120" height="1" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="24" bgcolor="#000000"></td>               
                <td width="5" height="24" style="background: url(images/menuheader.jpg)"></td>
                <td width="108" height="24" style="background: url(images/menuheader.jpg)" align="center"><font color="#ffffff"><b>Menu</b></font></td>
                <td width="5" height="24" style="background: url(images/menuheader.jpg)"></td>
                <td width="1" height="24" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="" bgcolor="#000000"></td>
                <td width="5" height=""></td>
                <td width="108" height="18" valign="middle"><a href="?page=home.htm">Home</a></td>
                <td width="5" height=""></td>
                <td width="1" height="" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td colspan="5" width="120" height="1" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="" bgcolor="#000000"></td>
                <td width="5" height=""></td>
                <td width="108" height="18" valign="middle"><a href="java script:window.external.AddFavorite('http://www.xxxx.dk','www.xxxx.dk');">F&oslashj til fortrukne</a></td>
                <td width="5" height=""></td>
                <td width="1" height="" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td colspan="5" width="120" height="1" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="" bgcolor="#000000"></td>
                <td width="5" height=""></td>
                <td width="108" height="18" valign="middle"><a href="?page=referfriend.htm">Henvisning en ven</a></td>
                <td width="5" height=""></td>
                <td width="1" height="" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td colspan="5" width="120" height="1" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="" bgcolor="#000000"></td>
                <td width="5" height=""></td>
                <td width="108" height="18" valign="middle"><a href="?page=gettingstarted.htm">Start</a></td>
                <td width="5" height=""></td>
                <td width="1" height="" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td colspan="5" width="120" height="1" bgcolor="#000000"></td>
              </tr>
           
           
            </table>
<!--              !!! Left menu end!!!                      -->
      </td>
    </tr>
   
             
        </table>
<!--                            -->       
           
          </td>
          <td width="10"></td>
          <td width="652" valign="top">           
         
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--                                                                      -->
<!--              Copyright 2005 www.xxxx.dk                              -->
<!--              DO NOT COPY ANYTHING FROM THIS FILE                      -->

<html>
<head>
<title>xxxx | webdesign seo webreklame webkampagner</title>

<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<meta name="DESCRIPTION" content="xxxx - webdesign, seo, webreklame, webkampagner">
<meta name="Keywords" content="webdesign, hjemmesidedesign, webbureau, webreklame, webkampagner, programmering, hjemmesidedesign, seo">
<meta name="xxxx" content="2006">

<!--              Text and link style                                      -->
<link rel="stylesheet" href="/css/xxxxstylesheet.css" type="text/css">


</head>


<!--              !!! Main menu !!!                      -->       
        <table width="652" cellspacing="0" cellpadding="0" border="0"  bgcolor="#C9D4E2">
              <tr>
                <td colspan="5" width="652" height="1" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="24" bgcolor="#000000"></td>
                <td width="5" height="24" style="background: url(images/menuheader.jpg)"></td>
                <td width="630" height="24" style="background: url(images/menuheader.jpg)"><font color="#ffffff"><b>Home</b></font></td>
                <td width="5" height="24" style="background: url(images/menuheader.jpg)"></td>
                <td width="1" height="24" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="5" bgcolor="#000000"></td>
                <td width="5" height="5"></td>
                <td width="630" height="5"></td>
                <td width="5" height="5"></td>
                <td width="1" height="5" bgcolor="#000000"></td>
              </tr>
             
              <tr>
                <td width="1" height="5" bgcolor="#000000"></td>
                <td width="5" height="5"></td>
                <td width="630" valign="top">
               
               
               
                  <table width="630" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td width="240" valign="top">
                     
                                           
<!--              !!! Main left vindue !!!                      -->                     
                        <table width="240" cellspacing="0" cellpadding="0" border="0" bgcolor="#EEEEEE">
                          <tr>
                            <td colspan="6" width="240" height="1" bgcolor="#000000"></td>
                          </tr>
                          <tr>
                            <td width="1" height="24" bgcolor="#000000"></td>
                            <td width="5" height="24"  style="background: url(images/menuheader.jpg)"></td>
                            <td width="148" height="24" style="background: url(images/menuheader.jpg)"><font color="#ffffff"><b>Velkommen til xxxx</b></font></td>
                            <td width="80" height="24" style="background: url(images/menuheader.jpg)" align="right"><font color="#ffffff"></font></td>
                            <td width="5" height="24" style="background: url(images/menuheader.jpg)"></td>
                            <td width="1" height="24" bgcolor="#000000"></td>
                          </tr>
                          <tr>
                            <td width="1" height="5" bgcolor="#000000"></td>
                            <td width="5" height="5"></td>
                            <td colspan="2" width="228" height="5"></td>
                            <td width="5" height="5"></td>
                            <td width="1" height="5" bgcolor="#000000"></td>
                          </tr>
                          <tr>
                            <td width="1" height="" bgcolor="#000000"></td>
                            <td width="5" height=""></td>
                            <td colspan="2" width="228" height="">
                              Denne side er kun til test af diverse script og er ikke en virksomhed.<br><br>
                            </td>
                            <td width="5" height=""></td>
                            <td width="1" height="" bgcolor="#000000"></td>
                          </tr>
                          <tr>
                            <td width="1" height="" bgcolor="#000000"></td>
                            <td width="5" height=""></td>
                            <td colspan="2" width="228" height="" align="right"></td>
                            <td width="5" height=""></td>
                            <td width="1" height="" bgcolor="#000000"></td>
                          </tr>
                          <tr>
                            <td width="1" height="5" bgcolor="#000000"></td>
                            <td width="5" height="5"></td>
                            <td colspan="2" width="228" height="5"></td>
                            <td width="5" height="5"></td>
                            <td width="1" height="5" bgcolor="#000000"></td>
                          </tr>
                          <tr>
                            <td colspan="6" width="240" height="1" bgcolor="#000000"></td>
                          </tr>
                         
                          <tr>
                            <td colspan="6" width="240" height="10" bgcolor="#C9D4E2"></td>
                          </tr>
                         
                        </table>
                       
                       
                      </td>
                      <td width="10"></td>
                      <td width="380" valign="top">
                     

                        <table width="380" cellspacing="0" cellpadding="0" border="0">
                          <tr>
                            <td colspan="6" width="380">

<!--              !!! News !!!                      -->
                         


                                  <table width="380" cellspacing="0" cellpadding="0" border="0" bgcolor="#EEEEEE">
                                  <tr>
                                    <td colspan="6" width="380" height="1" bgcolor="#000000"></td>
                                  </tr>
                                  <tr>
                                  <td width="1" height="24" bgcolor="#000000"></td>
                                  <td width="5" height="24"  style="background: url(images/menuheader.jpg)"></td>
                                  <td width="218" height="24" style="background: url(images/menuheader.jpg)"><font color="#ffffff"><b>Information</b></font></td>
                                  <td width="150" height="24" style="background: url(images/menuheader.jpg)" align="right"><font color="yellow"></font></td>
                                  <td width="5" height="24" style="background: url(images/menuheader.jpg)"></td>
                                  <td width="1" height="24" bgcolor="#000000"></td>
                                  </tr>
                                  <tr>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  <td width="5" height="5"></td>
                                  <td colspan="2" width="368" height="5"></td>
                                  <td width="5" height="5"></td>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  </tr>
                                  <tr>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  <td width="5" height="5"></td>
                                  <td colspan="2" width="368" height="5" bgcolor="#EEEEEE" align="center"><b>Lastest forum entries</b></td>
                                  <td width="5" height="5"></td>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  </tr>

                                  </table>


                                  <table width="380" cellspacing="0" cellpadding="0" border="0" bgcolor="#EEEEEE">
                                  <tr>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  <td width="5" height="5"></td>
                                  <td width="120" height="5" bgcolor="#EEEEEE" align="left"><b>Forum</b></td>
                                  <td width="158" height="5" bgcolor="#EEEEEE" align="left"><b>Topic</b></td>
                                  <td width="70" height="5" bgcolor="#EEEEEE" align="left"><b>Post time</b></td>
                                  <td width="5" height="5"></td>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  </tr>

                                    <tr>
                                    <td width="1" height="5" bgcolor="#000000"></td>
                                    <td width="5" height="5"></td>
                                    <td colspan="3" width="368" height="5" bgcolor="#EEEEEE" align="left"></td>
                                    <td width="5" height="5"></td>
                                    <td width="1" height="5" bgcolor="#000000"></td>
                                    </tr>
                                   
                                    <tr>
                                    <td width="1" height="5" bgcolor="#000000"></td>
                                    <td width="5" height="5"></td>
                                    <td width="120" height="5" bgcolor="#EEEEEE" align="left">forum_name</td>
                                    <td width="158" height="5" bgcolor="#EEEEEE" align="left">topic_title</td>
                                    <td width="70" height="5" bgcolor="#EEEEEE" align="left">tid</td>
                                    <td width="5" height="5"></td>
                                    <td width="1" height="5" bgcolor="#000000"></td>
                                    </tr>


                                  <tr>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  <td width="5" height="5"></td>
                                  <td colspan="3" width="368" height="5" bgcolor="#EEEEEE" align="left"></td>
                                  <td width="5" height="5"></td>
                                  <td width="1" height="5" bgcolor="#000000"></td>
                                  </tr>

                                  <tr>
                                    <td colspan="7" width="380" height="1" bgcolor="#000000"></td>
                                  </tr>

                                  <tr>
                                    <td colspan="7" width="380" height="10" bgcolor="#C9D4E2"></td>
                                  </tr>
                                  </table>

                         

                           
                            </td>
                          </tr>
                          <tr>
                            <td width="240" valign="top">                           

                           
                            </td>
                            <td width="10"></td>
                            <td width="240" valign="top">
                           
                             
                             
<!--              !!! Finishing up !!!                      -->                           
                            </td>
                          </tr>
                        </table>                 

                      </td>
                    </tr>
                  </table>

                </td>
                <td width="5" height="5"></td>
                <td width="1" height="5" bgcolor="#000000"></td>
              </tr>
                           
              <tr>
                <td colspan="5" width="652" height="1" bgcolor="#000000"></td>
              </tr>             
            </table>
            Copyright xxxx.dk<br><br>


<!--              !!! End of table format !!!                      -->

<!-- pictures below table                           -->


</body>
</html>

                             
<!--              !!! Finishing up !!!                      -->                           

          </td>
        </tr>
        <tr>
          <td colspan="3" width="782" height="10"></td>
        </tr>
      </table>

    </td>
  </tr>
</table>               


<!--              !!! End of table format !!!                      -->                           



</body>
</html>
Avatar billede keysersoze Ekspert
17. oktober 2006 - 09:49 #4
du har stadig 2 x </body></html>

fejl 1-4 ville jeg lægge om til styles - mener at bare margin: 0px; kan gøre tricket.
Avatar billede darrich Novice
17. oktober 2006 - 10:56 #5
Citat: fejl 1-4 ville jeg lægge om til styles
Hvordan? hvilke koder skal jeg anvende?
Avatar billede darrich Novice
17. oktober 2006 - 10:59 #6
De to gange html, header, body er grundet include af home.htm dokumentet.
Jeg har lavet home.htm i henhold til W3C, men i siger altså at alt undtagen selve koden indenfor body markeringerne skal fjernes i home.htm grundet det dynamisk  includes i index.php. Korrekt?
Avatar billede keysersoze Ekspert
17. oktober 2006 - 11:07 #7
style="margin: 0px;"

når du bruger includes bliver de enkelte dokumenter ikke opfattet af browseren som flere dokumenter men som ét samlet - derfor skal den kode der sammensættes af flere dokumenter altså også kunne valideres som ét samlet resultat. Så ja - hvis index.php indeholder body skal din home.htm ikke indeholde body.
Avatar billede darrich Novice
19. oktober 2006 - 10:47 #8
Hejsa - tak for hjælpen begge

Jeg har rettet ud fra jeres kommentarer og har nu kun fejl tilbage relateret til danske karakterer.


Warning Line 99 column 148: cannot generate system identifier for general entity "oslashj".
...F&oslashj til fortrukne</a></td>
Avatar billede keysersoze Ekspert
19. oktober 2006 - 10:54 #9
&oslash;
Avatar billede darrich Novice
19. oktober 2006 - 12:29 #10
Takker - lærte noget og fik løst problemet :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

IT-JOB

Forsvarsministeriets Materiel- og Indkøbsstyrelse

Nye kolleger søges til IT Stab i Forsvaret

Netcompany A/S

Test Consultant

Forsvarsministeriets Materiel- og Indkøbsstyrelse

Cyberdivisionen søger IT-Supporter til Svanemøllen