Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów
Validator xHTML + PHP - Wersja do druku

+- Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów (https://www.webmastertalk.pl)
+-- Dział: Technologie internetowe - tworzenie stron WWW (https://www.webmastertalk.pl/forum-technologie-internetowe-tworzenie-stron-www)
+--- Dział: xHTML, CSS, JavaScript (https://www.webmastertalk.pl/forum-xhtml-css-javascript)
+--- Wątek: Validator xHTML + PHP (/thread-validator-xhtml-php)



Validator xHTML + PHP - rabbit404 - 04-05-2009

Witam wszystkich uzytkowników! Big Grin

Stworzyłem swoja pierwsza strone opieracjaca sie o xhtml oraz css i napotkałem pewien problem z validatorem xhtml.
Kod zapisany został w pliku index.php w którym umieściłem funkcję
<?php include('menu.php');?> odwołująca sie do menu na mojej stronie.

Validator po sprawdzeniu pliku wywołuje jeden błąd:

Line 37, Column 44: document type does not allow element "html" here
<html xmlns="http://www.w3.org/1999/xhtml" >

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).


Usunąłem już sporo niezgodnosci kodu, lecz w tym przypadku nie mam pojecia co jest nie tak ;-) Poniżej przedstawiam kod źródłowy wyświetlany przez validator (połączone index.php + menu.php)

Mam nadzieje ze wyjaśniłem się dosyć jasno by ocenić co jest przyczyną tego błędu.

Kod:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-2" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="Nazwa strony" />
<meta name="keywords" content="slowa kluczowe" />
<meta name="robots" content="index, follow" />
<title>Tytul </title>
<link href="css/style-php.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="strona">
<map name="link-top" id="mapa2">
<area href="index.html" shape="rect" coords="24, 39, 335, 132" alt="Strona Gwna" id="mapa" />
</map>
<div id="menuTop">
<ul>
MENU DODATKOWE
</ul>
</div>
<div id="logo"> <img src="obrazki/logo-top.jpg" usemap="#link-top" alt="" style="border: 0;" /></div>
<div id="boxTop"></div>
<div id="menu2">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-2" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="Nazwa strony" />
<meta name="keywords" content="slowa kluczowe" />
<meta name="robots" content="index, follow" />
<title>Tytul</title>
<link href="css/style-menu-php.css" rel="stylesheet" type="text/css" />
</head>
<body>

TRESC MENU

</p>
</div>
</body>
</html>
</div>

<div id="content">

TRESC STRONY

</div>
<div id="footer"><img src="obrazki/copyright.gif" id="pozycja-copyright" alt="" /></div>
</div>
</body>
</html>



RE: Validator xHTML + PHP - Labsta.com - 04-05-2009

Bez obrazy, ale tekiego numeru jeszcze nie widziałem.
Masz dwie sekcje <head> + jeszcze dodatkowy <html>
Rozumiesz w czym rzecz?


RE: Validator xHTML + PHP - rabbit404 - 04-05-2009

Tak, ale to są dwa odrębne pliki - Validator wyświetla taki kod
(nie żebym nie wiedział że jest jedno head i html Big Grin)

**EDIT**

No i mam haka - dopiero co przerzuciłem sie z <iframe> na include,
więc w myślałem ze w pliku menu.php również potrzebuje zaznaczniki.
Myliłem się jednak - wywaliłem wszystkie zaznaczniki i działa.

Czyżby temat do kasacji?


RE: Validator xHTML + PHP - Labsta.com - 05-05-2009

No tak też myślałem, że może includowałaś cały html i dlatego ten bałagan się zrobił.