HTML 严格验证无法识别我导入的文档?

发布于 2024-12-26 07:05:07 字数 1640 浏览 4 评论 0原文

我只是验证我的网页并解决错误。我遇到的情况是,我具有通过 导入头文件的结构以及我的导航文件。现在,在浏览器中查看它是有效的,但是当我使用 XHMTL1.1 strict 进行验证时,它会出现错误。

所以我有一个index.php,它导入了header.php和navigation.php - 现在当我写这篇文章时,我意识到navigation.php没有将css文件导入其中,但验证器不仅仅读取html?那么它应该拿起它并查看它是否获取了信息?

请让我知道我是否走在正确的轨道上,否则看起来你牺牲了结构化网站的验证?

干杯杰夫 PS 新年快乐:-)

编辑代码:

URI:http://thepalmsmarket.co.nz/index.php 276 9 没有属性“id”a 276 24 没有属性“class”a 276 38 元素“nav”未定义

我这些是最后的错误,它们与此代码相关:

index.php:

<?php include_once ("01includes/header.php"); ?>

</head><!--hmtl tag closes in the footer--> 

<body class="no-js"><!--The script here is to disable the class put into the body tag if javascript is enabled.--> 
<?php include_once ("01includes/navigation.php"); ?>

navigation.php:

<nav id="topNav" class="centeredmenu">  
<ul>
    <?php
        $subject_set = mysql_query("SELECT * FROM webMenu", $dbconnect);
        if (!$subject_set) {
        die("Database query failed: " . mysql_error());
        }
        while ($subject = mysql_fetch_array($subject_set)) {
        echo "<li class=\"{$subject["class"]}\"><a href=\"   {$subject["link"]}\" onclick=\"{$subject["javascript"]}\" title=\"{$subject["title"]}\">{$subject["menuItem"]}</a></li>"; }
    ?>
</ul>

css 在desktop.css 中声明,该css 被导入到header.php 中,但不会导入到navigation.php 中,因为这将是双重的 - 希望这是有道理的:-)

I am just validating my webpage and working through the errors. the scenario I have is that I have the structure where I import a header file, through <?php include ('header.php') ?> and also with my navigation file. Now in terms of seeing it in the browser this works, but when I validate with XHMTL1.1 strict it comes up with the error.

So I have an index.php which imports both the header.php and navigation.php - now as I am writing this I am realizing that the navigation.php does not get the css file imported into it, but does the validator not just read the html? so there it should pick it up and see that it gets the information?

Please let me know if I am on the right track with this, otherwise it seems that you sacrifice validation for a structured website??

Cheers Jeff PS Happy New Year:-)

EDIT CODE:

URI: http://thepalmsmarket.co.nz/index.php a
276 9 there is no attribute "id" a
276 24 there is no attribute "class" a
276 38 element "nav" undefined

I these are the last errors and they are related to this code:

index.php:

<?php include_once ("01includes/header.php"); ?>

</head><!--hmtl tag closes in the footer--> 

<body class="no-js"><!--The script here is to disable the class put into the body tag if javascript is enabled.--> 
<?php include_once ("01includes/navigation.php"); ?>

navigation.php:

<nav id="topNav" class="centeredmenu">  
<ul>
    <?php
        $subject_set = mysql_query("SELECT * FROM webMenu", $dbconnect);
        if (!$subject_set) {
        die("Database query failed: " . mysql_error());
        }
        while ($subject = mysql_fetch_array($subject_set)) {
        echo "<li class=\"{$subject["class"]}\"><a href=\"   {$subject["link"]}\" onclick=\"{$subject["javascript"]}\" title=\"{$subject["title"]}\">{$subject["menuItem"]}</a></li>"; }
    ?>
</ul>

The css is declared in desktop.css which is imported into header.php, but not into navigation.php as that would be a double up - hope that makes sense:-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听不够的曲调 2025-01-02 07:05:07

好消息:与 PHP 无关。您似乎正在使用 HTML5 中的新标签 nav ,同时根据 XHTML 1.1 Strict 进行验证。如果您切换到 HTML5 声明,以便可以以良好、有效、语义的方式使用 nav,那么您将不得不追查其他一些验证错误(主要与元标记相关) ,然后在代码中进一步使用已弃用的 border 属性 - 验证错误应该是不言自明的)。如果您想继续使用 XHTML,请放弃使用 nav

Good news: nothing to do with PHP. You appear to be using the nav tag, which is new in HTML5, while validating against the XHTML 1.1 Strict. If you switch to an HTML5 declaration, so that you can use nav in a nice, valid, semantic way, then you'll have to chase down a few other validation errors (mostly related to the meta tags, and then use of a deprecated border attribute further on in your code -- the validation errors should be self-explanatory). If you want to keep on with XHTML, then drop the use of nav to be valid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文