Question

I work for a company who's primary clients still use Internet Explorer 7 (NHS etc).

In our code we generate snippets of HTML in various places and Eclipse is generating lots of warnings relating to markup that is obsolete in HTML5.

I know that setting a valid doctype of HTML4 fixes the problem on flat html files but as we build the code over several PHP files we can't set a doctype in the snippets.

Is there a way to change the 'default' doctype to HTML4 globally or by project as I do not want to turn off the warnings as that may cause me to miss actual issues.

Était-ce utile?

La solution

Drove me nuts too until I found the answer...

http://www.eclipse.org/forums/index.php/t/219788/

Steps:

  1. Select an HTML file in the PHP Explorer. If there are no HTML files, create a new one.
  2. Right-click > Properties > Web Content Settings.
  3. Choose preferred doctype in the Document type list.
  4. Click OK and exit Eclipse.
  5. Open {your_workspace}/{your_project}/.settings/org.eclipse.wst.html.core.prefs with a text editor.
  6. Replace document-type/{your_file_name}=... by document-type/<project>=... (do not modify <project>, paste it as-is)
  7. Start Eclipse.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top