Jump to content

Will an XHTML DOCTYPE interfere with my PHP if I'm not experienced enough?


webmaster1

Recommended Posts

Notice the age of the article. Every site I build has output as XHTML, and I've never had a problem. Here is my favorite type of DOCTYPE:

 

Good point. Cheers for highlighting that. However, is any of this important:

 

Things You Can Do in HTML But Cannot Do in XHTML

'Hide' the contents of style or script elements with SGML comments (<!--…-->).

Create parts of the page dynamically with JavaScript while the document is still loading (e.g., using document.write()).

Use named character entities (e.g.,  ) other than the four predefined ones: <, >, & and ".

Use the .innerHTML property with JavaScript (technically this is non-standard even in HTML).

 

Here is my favorite type of DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

I've come across it across that herr also: http://www.alistapart.com/articles/doctype/

 

Thanks for confirming!

 

At the risk of going slightly off-topic: Why not XHTML 1.1?

Link to comment
Share on other sites

Are you sure you even need xhtml? maybe you should take a look at thsi thread before doing so.

 

Thanks Thorpe. That's a god send because it's current. I'm still reading it but Daniel0 has offered a good overview of why not to use XHTML. I'm now of the opinion that it's essentially unnecessary and of an uncertain future.

 

The only consideration I have for using it is that SMF is built in XHTML. A section of a site I'm currently building will be using SMF 2.0 for which I'm building a custom theme to match the rest of the site. The header section is universal to pages of the site (forum or not) so I'm essentially going to need to code the header for the non-forum/non-xhtml pages in html 4.0 and the header for the forum/xhtml pages in xhtml.

 

I just don't like the idea of having to use different DOCTYPES across the site. I don't think I'll have beef with a custom Wordpress theme since I can build it from scratch and determine the DOCTYPE.

 

I think.  :-\

 

 

Link to comment
Share on other sites

I just don't like the idea of having to use different DOCTYPES across the site. I don't think I'll have beef with a custom Wordpress theme since I can build it from scratch and determine the DOCTYPE.

 

It depends what you're going to use. If SMF is indeed validated with XHTML than you should use that. If you're wanting to use HTML comments (IE: <!-- -->) than it will invalidate your doctype, but will still work.

 

Doctypes won't make or break a page, but it is important to stick within one set dictionary. TheW3 Validator can match your page, if you're wanting to against a doctype.

Link to comment
Share on other sites

Doctypes won't make or break a page, but it is important to stick within one set dictionary. TheW3 Validator can match your page, if you're wanting to against a doctype.

 

What do you mean by 'one dictionary'? One language across a page or one DOCTYPE across a site?

 

TheW3 Validator can match your page, if you're wanting to against a doctype.

 

I don't understand.

Link to comment
Share on other sites

Why not just look at an article with all the answers?

http://www.w3schools.com/XHTML/xhtml_html.asp

 

And ask yourself this.

 

Does SMF use XHTML/xml tags?

Do you want to be able to use XHTML tags instead of the standard HTML docset?

 

A doctype, again, will have nothing to do with your page except allow validation of the structure of your page. A doctype will not affect your PHP in any way, atleast not in what normal programming conventions use.

Link to comment
Share on other sites

Doctypes won't make or break a page, but it is important to stick within one set dictionary. TheW3 Validator can match your page, if you're wanting to against a doctype.

 

What do you mean by 'one dictionary'? One language across a page or one DOCTYPE across a site?

 

TheW3 Validator can match your page, if you're wanting to against a doctype.

 

I don't understand.

 

Pick a doctype to use, code according to its rules, and use the validator to verily that your code adheres to that doctype's rules.  If you're extending or editing code that conforms to a particular doctype, write your code accordingly.

 

If you want to keep it simple, from what I've read HTML 5's doctype is sufficient to ensure the browser doesn't render the page in quirks mode.  That doctype is simply <!DOCTYPE html>  Some caveats - there's no way to validate your HTML's well-formedness using this doctype.  HTML 5 is still in the planning stages, so this doctype declaration is essentially a hack.  So, you shouldn't use it if you don't feel comfortable or confident in your ability to write markup correctly the first time.

Link to comment
Share on other sites

Why not just look at an article with all the answers?

http://www.w3schools.com/XHTML/xhtml_html.asp

 

That's the first thing I read but there's so many arguments I've encountered thereafter contradicting the conveyed viability and necessity of the use of XHTML.

 

 

Do you want to be able to use XHTML tags instead of the standard HTML docset?[/b]

 

 

Is that rhetorical? I honestly don't know. I can't think of a reason why I'd need to use XHTML other than the fact that SMF 2.0 is built in said language.

 

 

Link to comment
Share on other sites

 

Pick a doctype to use, code according to its rules, and use the validator to verily that your code adheres to that doctype's rules.  If you're extending or editing code that conforms to a particular doctype, write your code accordingly.

 

 

Fair enough but can I build one section of my site in XHTML (forum) and the rest in HTML 4.0?

Link to comment
Share on other sites

I'm still reading it but Daniel0 has offered a good overview of why not to use XHTML. I'm now of the opinion that it's essentially unnecessary and of an uncertain future.

 

Don't change your opinion just because someone with a rep. made some good arguments. No need for dogmatic thinking research it yourself see if all of his points are indeed true and if not counter-argue. Don't mistake me here and I certainly don't want to question Daniel's knowledge quite the contrary but not everyone is like Daniel and it's best to not always take someone's word for it. Plus March 2009 is not so current..

 

Remember only intelligent people ask questions all other just nod.

 

Edit: nevermind

Link to comment
Share on other sites

I'm still reading it but Daniel0 has offered a good overview of why not to use XHTML. I'm now of the opinion that it's essentially unnecessary and of an uncertain future.

 

Don't change your opinion just because someone with a rep. made some good arguments. No need for dogmatic thinking research it yourself see if all of his points are indeed true and if not counter-argue. Don't mistake me here and I certainly don't want to question Daniel's knowledge quite the contrary but not everyone is like Daniel and it's best to not always take someone's word for it. Plus March 2009 is not so current..

 

Remember only intelligent people ask questions all other just nod.

 

Edit: nevermind

 

I've asked questions. The answers in many cases have been ambiguous. The only verity I've encountered is that the hallmarks of XHTML are not requisite after careful consideration of the trajectory of web standards. Am I not correct to assume that XHTML is more or less redundant?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.