-3

少しお役に立てればと思いました。

まず第一に、私はコーディングの初心者レベルにいるので、私にあまり苦労しないでください:)

ウェブサイトでコードを検証しようとしていますが、取り除くことができない厄介なエラーが発生します。 ソースコードは次のとおりです。

<div id="mainWrapperbackground">
    <div id="allContentbackground">
        <img src="img/banner.png" alt="banner" id="banner">
        <img src="img/left.jpg" alt="leftside" id="left">
        <img src="img/right.jpg" alt="rightside" id="right">
        <img src="img/nav.png" alt="navigation" id="fullnav">
        <img src="img/poleright.png" alt="poleright" id="poleright">
        <img src="img/poleleft.png" alt="poleleft" id="poleleft">
        <img src="img/footer.jpg" alt="footer" id="footerimg">
        <form method="get" action="/search" id="search">
            <input name="index.php?page=recipe1" type="text" size="40" placeholder="Search..." >
        </form>

        <div id="footer">
            <em>Rising Cupcakes | Fairystreet 182st | 4500 Wonderland | Tel. +88 21 45 65</em>
        </div></div></div>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <link href="styles.css" rel="stylesheet" />
        <title>Cupcake Lovers</title>
    </head>
    <body>
        <div id="mainWrapper">
            <div id="allContent">
                <div id="mainWrapperbackground"> 
                    <div id="allContentbackground"> 
                        <nav id="global-nav"> 
                            <a href="index.php?page=contact"> <img src="img/contactb.png" alt="contactb" id="contactb"></a> <a href="index.php?page=guestbook"><img src="img/guestbookb.png" alt="guestbookb" id="guestbookb"></a> <a href="index.php?page=newsletter"><img src="img/newsletterb.png" alt="newsletterb" id="newsletterb"></a> <a href="index.php?page=history"><img src="img/historyb.png" alt="historyb" id="historyb"></a> <a href="mailto:cupcake@recipes.dk"><img src="img/maillogo.png" alt="maillogo" id="maillogo"></a> <a href="http://www.facebook.com"><img src="img/fblogo.png" alt="facebooklogo" id="fblogo"></a> <a href="index.php?page=home"><img src="img/homeb.png" alt="homeb" id="homeb"></a> <a href="index.php?page=recipegallery"><img src="img/recipesb.png" alt="recipesbutton" id="recipesb"> </a> 
                        </nav> 
                        <img src ="img/cupcake.png" alt="cupcake" id="cupcake"> 
                        <div id="homehead"> 
                        <h5>Welcome!
                    </h5> 
                </div> 
                <p class="first">Welcome to <b>"Cupcake Lovers"!</b>
                <br>
                    <br> 
                        We have opened this homepage to introduce you to Celina's 6 most famous cupcake recipes.
                        <br> 
                            Celina's recipes follow the principle of being easy to make, beautiful to look at, and delicious to eat!
                            <br> 
                                If like Celina, cupcakes are your passion, then go learn about the history of cupcakes or join our 
                                <br>
                                    newsletter and get updates about what's going on in the world of cupcakes. 
                                    <br>
                                        <br>
                                            Don't forget to sign our guestbook!
                                            <br>
                                                <br>
                                                    Happy baking,
                                                    <br>
                                                        <em>Celina's cupcakes for Cupcake Lovers</em>
                                                        <br> 
                                                            ----------------------------------------------------------------------------------------------------------------------------- 
                                                        </p> 
                                                    </div>
                                                </div>
                                            </body>
                                        </html>

バリデーターは次のように述べています 。3行目、1列目:文書型宣言なし。検証なしで解析されます(このファイルを入力すると、大量のエラーで検証されます)19行目、3列目:「DOCTYPE」宣言はインスタンスでは許可されていません20行目、6列目:ドキュメントタイプは要素「HTML」を許可していません" ここ

しかし、問題は、fxのようなhtmlタグを使用していないということです。これらのファイルでは、phpファイルに生成させます。

私のindex.phpは次のようになります:

<?php

include "magic-1.4.php";    
include "background.php";   

$page = new Page(); 
$title = "Cupcake Lovers"; 
$href = "styles.css";
$page->title($title)->css($href); 
$wrapper = html("div")->id("mainWrapper"); 
$content = html("div")->id("allContent");   

$content->append(file_get_contents("views/nav.php"));   

$section = new HtmlElm("section");

$request = new Controller(); 
if($request->has("page")){
    $requestedPage = $request->get("page"); 
}
else{
    $requestedPage = 'home'; 
}

if($requestedPage=="home"){
    $content->append(file_get_contents("views/home.php"));
}   

$wrapper->append($content); 
$page->body($wrapper);

//convert the page object to HTML and echo it to browser echo
$page->asHTML();

だから私の質問は、phpが3つのhtmlページのように生成し、それが本当に間違っていることを検証するので、私は何を間違っているのかということです。

4

1 に答える 1

1

<!DOCTYPE html>ニーズはブラウザが最初に目にするものである必要があるため、何よりも先に進む必要があります。に<div id="mainWrapperbackground">入る必要があり<body>ます。この後、バリデーターが表示するエラーを1つずつ確認する必要があります。

于 2012-11-20T19:57:04.250 に答える