Jump to content

Validating html within a .php file


wright67uk

Recommended Posts

Although Im familiar with using validators for html and css.

What in your opinion would be the best way to run my files through a validator?

The validator I currently use http://validator.w3.org/ thows up 75 errors as it is looking at my php.

Is it best to turn my php into an html comment for the purpose of testing the html, or is there a better way of testing my files that contain server side scripting?

maybe there is a validator that ignores anything within php tags?

 

Link to comment
https://forums.phpfreaks.com/topic/240469-validating-html-within-a-php-file/
Share on other sites

Your php based page is not a complete web document until the php code in it has been parsed, tokenized, interpreted, and the php code outputs the dynamically produce portions of the page.

 

If you are doing this on a localhost development system, you would browse to the page on your localhost server and copy/paste the 'view source' from your browser into the w3.org validator. If you are doing this on a publicly accessible server, you would enter the URL of the page into the w3.org validator.

Alternately, if you're using FF with the web developer tools installed, you should have a "Validate Local HTML" option in the Tools ---> Web Developer ---> Tools menu (or Command-Shift-A on Mac OS).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.