Validating php files

For technical support for all editions of CSE HTML Validator. Includes bug reports.

Validating php files

Postby Lou » Sun May 15, 2011 2:40 pm

When I validate file index.php which included:

Code: Select all
<body id="index">
   <div align="center">
      <script language="php">
         include "$root/include/header.html";
      </script>


I get the following warning on the 3rd line:
Code: Select all
Missing "type" attribute. HTML 4.01 and XHTML (but not HTML5) require the "type" attribute for the "script" element to specify the scripting language.


And the following error on the 4th line:
Code: Select all
[JavaScript] SyntaxError: missing ; before statement


Of course neither line is seen by a browser.
User avatar
Lou
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 180
Joined: Fri Jul 29, 2005 5:55 pm
Location: MD

Re: Validating php files

Postby Albert Wiersch » Mon May 16, 2011 3:29 pm

Hi Lou,

I should be able to exclude the warning about the missing "type" attribute when language="php". Unfortunately, JavaScript Lint tries to check that script even though it is PHP. I believe it ignores the type of script and just assumes it is JavaScript and thus checks it. I'll also see if I can make this issue less likely to happen by not running JavaScript Lint for a document if there is only a PHP script in the document.

This will have to wait for a v11 release though, but if you'd like I can see if I can make this change using only the config file, and make a config file update available sooner. Please let me know if this would be useful to you and I will try to get it done within the next few days.

Thank you.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: Validating php files

Postby Lou » Mon May 16, 2011 5:49 pm

Albert, What ever you can do easily in the near term would be great. Obviously (to me) this is really a two step process. First checking the php file and secondly checking the html actually sent to the browser.

I've got myself into this mess and whatever tools I can use, will help.

Thanks.
User avatar
Lou
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 180
Joined: Fri Jul 29, 2005 5:55 pm
Location: MD

Re: Validating php files

Postby Albert Wiersch » Tue May 17, 2011 11:34 am

Hi Lou,

Please try this new config file:
http://www.htmlvalidator.com/htmlvalV100cfg.zip

It should eliminate the missing type attribute warning when language="php".

There's a readme file in the ZIP that should tell you how to update your config file.

Please let me know how it works. Thanks!
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX


Return to CSE Tech Support

Who is online

Users browsing this forum: No registered users and 1 guest