###前提・実現したいこと
https://validator.w3.org/
上の構文チェッカーを利用して、正しいhtmlを書こうと思っています。
①index.htmlで作成し、それを構文チェックすると、エラーなしと表示されました。
②index.htmlをSmarty用にindex.phpとindex.tplに分け、それ以外のソースコードは全く手を加えていないのに、index.phpをチェックすると先ほどには出なかったエラーが表示されてしまいました。
###発生している問題・エラーメッセージ
構文チェックで表示されたメッセージは以下です。
Error: Forbidden code point U+0004. At line 1, column 1 <!DOCTYPE html Error: Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>. At line 1, column 1 <!DOCT Error: Element head is missing a required instance of child element title. At line 1, column 1 <!DOCT Content model for element head: If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content, of which no more than one is a title element and no more than one is a base element. Otherwise: One or more elements of metadata content, of which exactly one is a title element and no more than one is a base element. Error: Stray doctype. From line 1, column 2; to line 1, column 16 <!DOCTYPE html>↩<html Error: Stray start tag html. From line 2, column 1; to line 2, column 16 YPE html>↩<html lang="ja">↩<head Fatal Error: Cannot recover after last error. Any further errors will be ignored. From line 2, column 1; to line 2, column 16 YPE html>↩<html lang="ja">↩<head
###該当のソースコード
php
1<?php 2require('Smarty'); 3 4$smarty = new Smarty; 5$smarty->display('index.tpl'); 6
html
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 5・・・以下特にエラーメッセージなし 6
###試したこと
エラーコードを検索して、向こうな空文字が原因などと出てきたのですが、
エラーが出なかったindex.htmlをコピーして、文字コードも変更していないので、それが原因ではないような気がします。
どうすればエラーが解消できるのか、お手数ですが、よろしくお願いいたします。
###補足情報(言語/FW/ツール等のバージョンなど)
Smarty 3.1.30

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/08/20 06:57