W3C aime t'il les syntaxes du php dans xhtml

Fermé
Mortimer59 Messages postés 139 Date d'inscription vendredi 27 juillet 2007 Statut Membre Dernière intervention 31 août 2018 - 22 sept. 2008 à 11:24
vignemail1 Messages postés 1246 Date d'inscription vendredi 8 octobre 2004 Statut Contributeur Dernière intervention 13 septembre 2019 - 22 sept. 2008 à 13:57
Bonjour,


W3C aime t'il les syntaxes du php dans xhtml?

je teste mon script à commencer par home.php ainsi ce qui est validé si j'applique leurs conseils mon code qui ressemble à ceci :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti
onal.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"<?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="<?php bloginfo('description'); ?>" />
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/menu.css" type="text/css" media="screen" />

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/common.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/links.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/lists.css" type="text/css" media="screen" />

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/blog.css" type="text/css" media="screen" />

<link rel="Shortcut Icon" href="<?php echo get_settings('home'); ?>/wp-content/themes/oupocreanum/images/favicon.
ico" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<link rel="stylesheet" href="http://olivierbaudrydesign.free.fr/wp-cont
ent/plugins/podpress/podpress.css" type="text/css" />
<script type="text/javascript">
<!--
var podPressBackendURL = "http://olivierbaudrydesign.free.fr/wp-content/p
lugins/podpress/";
var podPressText_PlayNow = "Play Now";
var podPressText_HidePlayer = "Hide Player";
// -->
</script>
<script type="text/javascript" src="http://olivierbaudrydesign.free.fr/wp-conte
nt/plugins/podpress/podpress_js.php"></script
>

<?php wp_get_archives('type=monthly&format=link');
?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>

<script language="JavaScript" type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVer
sion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

</head>
<body>
<!-- end header -->


Mon code devient alors :


voilà la suite j'ai réalisé ceci en suivant la description du W3C il ne me reste que trois erreurs à la fin néanmoins je ny comprend rien j'ai du supprimer certains < des expressions <?php ();> :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti
onal.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><?php language_attributes(); ?>

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="?php bloginfo('description'); ?>" />
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

<meta name="generator" content="WordPress ?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->

<link rel="stylesheet" href="?php bloginfo('template_url'); ?>/menu.css" type="text/css" media="screen" />

<link rel="stylesheet" href="?php bloginfo('template_url'); ?>/common.css" type="text/css" media="screen" />
<link rel="stylesheet" href="?php bloginfo('template_url'); ?>/links.css" type="text/css" media="screen" />
<link rel="stylesheet" href="?php bloginfo('template_url'); ?>/lists.css" type="text/css" media="screen" />

<link rel="stylesheet" href="?php bloginfo('template_url'); ?>/blog.css" type="text/css" media="screen" />

<link rel="Shortcut Icon" href="?php echo get_settings('home'); ?>/wp-content/themes/oupocreanum/images/f
avicon.ico" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="?php bloginfo('atom_url'); ?>" />

<link rel="pingback" href="?php bloginfo('pingback_url'); ?>" />

<link rel="stylesheet" href="http://olivierbaudrydesign.free.fr/wp-cont
ent/plugins/podpress/podpress.css" type="text/css" />
<script type="text/javascript">
<!--
var podPressBackendURL = "http://olivierbaudrydesign.free.fr/wp-content/p
lugins/podpress/";
var podPressText_PlayNow = "Play Now";
var podPressText_HidePlayer = "Hide Player";
// -->
</script>
<script type="text/javascript" src="http://olivierbaudrydesign.free.fr/wp-conte
nt/plugins/podpress/podpress_js.php"></script
>

<?php wp_get_archives('type=monthly&format=link');
?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>

<script language="JavaScript" type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVer
sion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

</head>

<!-- end header -->
<body/>


et Voilà les fameux conseils du W3C


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti
onal.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"<?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="<?php bloginfo('description'); ?>" />
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/menu.css" type="text/css" media="screen" />

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/common.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/links.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/lists.css" type="text/css" media="screen" />

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/blog.css" type="text/css" media="screen" />

<link rel="Shortcut Icon" href="<?php echo get_settings('home'); ?>/wp-content/themes/oupocreanum/images/favicon.
ico" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<link rel="stylesheet" href="http://olivierbaudrydesign.free.fr/wp-cont
ent/plugins/podpress/podpress.css" type="text/css" />
<script type="text/javascript">
<!--
var podPressBackendURL = "http://olivierbaudrydesign.free.fr/wp-content/p
lugins/podpress/";
var podPressText_PlayNow = "Play Now";
var podPressText_HidePlayer = "Hide Player";
// -->
</script>
<script type="text/javascript" src="http://olivierbaudrydesign.free.fr/wp-conte
nt/plugins/podpress/podpress_js.php"></script
>

<?php wp_get_archives('type=monthly&format=link');
?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>

<script language="JavaScript" type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVer
sion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

</head>
<body>
<!-- end header -->
Par ailleurs existe t'il un outil pour débugger du javascript et du css?

# 21/09/08 18:10 de Baudry
Je viens d'aller sur http://validator.w3.org/check et voilà ce qu'on me dit : 7 Errors, 13 warning(s)
# Error XML Parsing Error



* Line 2, column 42: XML Parsing Error: error parsing attribute name

<html xmlns="http://www.w3.org/1999/xhtml"<?php language_attributes(); ?>>

* Line 2, column 42: XML Parsing Error: attributes construct error

<html xmlns="http://www.w3.org/1999/xhtml"<?php language_attributes(); ?>>

* Line 2, column 42: XML Parsing Error: Couldn't find end of Start Tag html line 2

<html xmlns="http://www.w3.org/1999/xhtml"<?php language_attributes(); ?>>

* Line 2, column 73: XML Parsing Error: Extra content at the end of the document

…g/1999/xhtml"<?php language_attributes(); ?>>
# Warning unclosed start-tag requires SHORTTAG YES



The construct <foo<bar> is valid in HTML (it is an example of the rather obscure “Shorttags” feature) but its use is not recommended. In most cases, this is a typo that you will want to fix. If you really want to use shorttags, be aware that they are not well implemented by browsers.

* Line 2, column 42: unclosed start-tag requires SHORTTAG YES

<html xmlns="http://www.w3.org/1999/xhtml"<?php language_attributes(); ?>>
# Error character data is not allowed here



You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:

* putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or
* forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or
* using XHTML-style self-closing tags (such as <meta ... />) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.

* Line 2, column 73: character data is not allowed here

…g/1999/xhtml"<?php language_attributes(); ?>>

# end tag for X omitted, but OMITTAG NO was specified



You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

* Line 53, column 19: end tag for "body" omitted, but OMITTAG NO was specified

<!-- end header -->

* Line 53, column 19: end tag for "html" omitted, but OMITTAG NO was specified

<!-- end header -->

# Warning character X is the first character of a delimiter but occurred as data



This message may appear in several cases:

* You tried to include the "<" character in your page: you should escape it as "<"
* You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe.
* Another possibility is that you forgot to close quotes in a previous tag.

* Line 6, column 34: character "<" is the first character of a delimiter but occurred as data

<meta name="Description" content="<?php bloginfo('description'); ?>" />

* Line 9, column 42: character "<" is the first character of a delimiter but occurred as data

… name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- l

* Line 11, column 29: character "<" is the first character of a delimiter but occurred as data

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/menu.css" type="

* Line 13, column 29: character "<" is the first character of a delimiter but occurred as data

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/common.css" type

* Line 14, column 29: character "<" is the first character of a delimiter but occurred as data

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/links.css" type=

* Line 15, column 29: character "<" is the first character of a delimiter but occurred as data

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/lists.css" type=

* Line 17, column 29: character "<" is the first character of a delimiter but occurred as data

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/blog.css" type="

* Line 19, column 32: character "<" is the first character of a delimiter but occurred as data

<link rel="Shortcut Icon" href="<?php echo get_settings('home'); ?>/wp-content/t

* Line 20, column 71: character "<" is the first character of a delimiter but occurred as data

…e="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />

* Line 21, column 60: character "<" is the first character of a delimiter but occurred as data

<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />

* Line 22, column 73: character "<" is the first character of a delimiter but occurred as data

…pplication/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />

* Line 24, column 27: character "<" is the first character of a delimiter but occurred as data

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />


Bon de plus le fais qu'à chaque fois le < introduisant le php saute ça ne rend plus grand chose de lisible dans dreamweaver comment faire?

pour coder ce script xtml correctement?
A voir également:

5 réponses

vignemail1 Messages postés 1246 Date d'inscription vendredi 8 octobre 2004 Statut Contributeur Dernière intervention 13 septembre 2019 259
22 sept. 2008 à 11:36
Le validateur vérifie le code (x)HTML, ton code PHP sera interprété par ton serveur pour donné du code (x)HTML donc le validateur n'aura accès qu'à du code (x)HTML. Il faut donner au validateur le code (x)HTML produit, pas ton code source PHP.
Dreamweaver est bien pour les novices car cela leur permet de réaliser un code à peu près clair avec des outils suffisamment complet pour ce qu'ils ont à faire. Concernant la manière de mieux coder le tout, la seule solution viable est donc de coder tout à la main avec un éditeur de texte style notepad++
0
Mortimer59 Messages postés 139 Date d'inscription vendredi 27 juillet 2007 Statut Membre Dernière intervention 31 août 2018 12
22 sept. 2008 à 11:46
Si je comprends bien alors le validateur ne me sert à rien puisque j'ai un tas d'expressions php dans ma pages .Or je les enlève il ne reste pas grand chose à valider.
0
moicjm Messages postés 271 Date d'inscription mardi 16 octobre 2007 Statut Membre Dernière intervention 12 décembre 2012 18
22 sept. 2008 à 11:53
le validateur ne voit pas le php, car le PHP est traité par le serveur, qui renvoie une page vidée de tout PHP.
Un exemple : fait "affichage" "afficher le code source" et tu verras qu'il n'ya pas de PHP, il a été interprété par le serveur. Le validateur W3C voit la meme chose que toi.
0
Mortimer59 Messages postés 139 Date d'inscription vendredi 27 juillet 2007 Statut Membre Dernière intervention 31 août 2018 12
22 sept. 2008 à 11:58
bon est bien y a t'il une solution efficace pour déboguer du script. vu qu'a priri le W3C c'est pas vraiment au point.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
vignemail1 Messages postés 1246 Date d'inscription vendredi 8 octobre 2004 Statut Contributeur Dernière intervention 13 septembre 2019 259
22 sept. 2008 à 13:57
Utilise Firefox avec Firebug et Web Developer comme extension et tu auras ce qu'il te faut pour le développement web
0