Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2006, 12:48 AM
WebProWorld New Member
 

Join Date: Oct 2006
Posts: 3
John-pr RepRank 0
Default Xhtml strict 1.0 vs xhtml 1.1

Which one is better? XHTML STRICT 1.0 or XHTML 1.1
__________________
Delhi Business News - Dog Training
Reply With Quote
  #2 (permalink)  
Old 10-30-2006, 11:17 AM
stymiee's Avatar
WebProWorld Veteran
 

Join Date: May 2006
Location: New Jersey
Posts: 431
stymiee RepRank 0
Default

Neither. There is almost no difference between the two. Difference between 1.1 and 1:

1. On every element, the lang attribute has been removed in favor of the xml:lang attribute .
2. On the a and map elements, the name attribute has been removed in favor of the id attribute.
3. The "ruby" collection of elements has been added.

Using either one is not recommended because IE doesn't support XHTML yet.
__________________
John Conde
Brainyminds Merchant Account Services eBook Giant
Reply With Quote
  #3 (permalink)  
Old 10-30-2006, 03:24 PM
WebProWorld Veteran
 

Join Date: Mar 2006
Location: Maryland, USA
Posts: 972
weslinda RepRank 2
Default Why use it then?

Interesting point, so what language should we all work in as designers?
__________________
We offer a total eCommerce solution with eCommerce Web Design using Pinnacle Cart
Reply With Quote
  #4 (permalink)  
Old 10-30-2006, 04:11 PM
stymiee's Avatar
WebProWorld Veteran
 

Join Date: May 2006
Location: New Jersey
Posts: 431
stymiee RepRank 0
Default

HTML 4.01 Strict
__________________
John Conde
Brainyminds Merchant Account Services eBook Giant
Reply With Quote
  #5 (permalink)  
Old 10-30-2006, 04:15 PM
WebProWorld Veteran
 

Join Date: Mar 2006
Location: Maryland, USA
Posts: 972
weslinda RepRank 2
Default Interesting...

Interesting...both of the sites in your signature are doctyped at XHTML.

Why are you recommending HTML 4.01 Strict only? Are you saying IE can't do anything with documents built around the XHTML framework?
__________________
We offer a total eCommerce solution with eCommerce Web Design using Pinnacle Cart
Reply With Quote
  #6 (permalink)  
Old 10-30-2006, 04:32 PM
Easywebdev's Avatar
WebProWorld Veteran
 

Join Date: Apr 2004
Posts: 328
Easywebdev RepRank 1
Default

Quote:
Originally Posted by weslinda
Interesting point, so what language should we all work in as designers?
We should be using xhtml1.1 as it is the latest of the w3c standards. Just because the most popular browser does not properly support xhtml is no reason not to adopt it.

Writing xhtml1.1 for any browser without sending a proper application/xhtml+xml header is just writing "tag soup" and will be treated as "Content-type: text/html" so you need to use some server side programming to determine what the browser supports and send it a header it supports.

If you send the following xml prolog and dtd

Code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
without sending a header("Content-type: application/xhtml+xml"); Internet explorer will by default treat it as header("Content-type: text/html");

The problem with internet explorer is when you write xhtml1.1 and serve it as "Content-type: application/xhtml+xml" with a proper xhtml header that IE bites the bullet and refuses to parse it. So there is no problem sending IE xhtml1.1 with
Code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
and without an xhtml header as it just treats it as text/html but your code is up to date and ready for when IE implements xhtml support (all it will do is throw IE into quirks mode). They tried to cram it in for the release of IE7 but failed due to time constraints but from the IE developer blog they state that xhtml support WILL be in IE8, so there is no reason not to adopt xhtml1.1.

What I do is send the above xml prolog and dtd and use php to check what the browser supports and if it does not support application/xhtml+xml I just send it a "Content-type: text/html" header. The code will work in IE and browsers that dont support application/xml+xhtml and I send header("Content-type: application/xhtml+xml"); to browsers that do support it (firefox, safari, konqueror, opera) and all is hunky dory.

If you are using php then here is some php I pulled from my framework and rewritten as basic php functions that determine what the browser supports and sets a proper mimetype to output headers with.

save this as header.php
Code:
	function set_mimetype()
	{
	 	$mimetype = 'text/html';
	 	
	 	if(isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) 
		{
			/*
			 * The browser can handle application/xhtml+xml 
			 * We now check Q values to see what the browser actually prefers, html or xhtml.
			 * if there's a Q value for application/xhtml+xml then also retrieve the Q value for text/html
			 */
			 if(preg_match('/application\/xhtml\+xml;q=0(\.[1-9]+)/i', $_SERVER['HTTP_ACCEPT'], $matches))
			 {
			 	$xhtml_q = $matches[1];
			 	if(preg_match('/text\/html;q=0(\.[1-9]+)/i', $_SERVER['HTTP_ACCEPT'], $matches)) 
			 	{
			 		$html_q = $matches[1];
			 		/*
			 		 * if the Q value for XHTML is greater than or equal to that for HTML 
			 		 * then use the "application/xhtml+xml" mimetype
			 		 */
			 		if($xhtml_q >= $html_q) 
			 		{
			 			$mimetype = 'application/xhtml+xml';
			 		}
			 	}
			 }
			 else // if there was no Q value, then just use the application/xhtml+xml mimetype
			 {
			 	$mimetype = 'application/xhtml+xml';
			 }
		}
		
		/*
		 * The w3c validator does not send $_SERVER["HTTP_ACCEPT"] when requesting a document 
		 * but we know it can handle application/xhtml+xml so set the mimetype as that.
		 */
		if (isset($_SERVER['HTTP_USER_AGENT']) && stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) 
		{
			$mimetype = 'application/xhtml+xml';
		}
		return($mimetype);
	 }

	function output_headers()
	{
		// Cache-Control for HTTP/1.1, Pragma for older HTTP/1.0
		header ('Content-type: ' . set_mimetype() . '; charset='iso-8859-1');
		header ('Cache-Control: no-store, no-cache, must-revalidate'); 
		header ('Pragma: no-cache');                         
		header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
		header ('Expires: ' . gmdate('D, d M Y H:i:s', (time()-360000)) . ' GMT');
	}
then at the top of your php pages

Code:
include('header.php');
output_headers();
if you use the firefox webdeveloper extension you can then go to "information > View Page Information" and you will see the type set as application/xhtml+xml rather than text/html or text/plain.

xhtml support is in most major browsers and once you get to grips with it you will be outputting leaner/cleaner code. If you use the code above you may want to edit the headers if you want to cache pages etc.
__________________
"I have not failed. I have found 10,000 ways that don't work" - Thomas Edison.
"The secret to creativity is knowing how to hide your sources" - Albert Einstein.
Reply With Quote
  #7 (permalink)  
Old 10-31-2006, 12:22 AM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,402
kgun RepRank 3kgun RepRank 3kgun RepRank 3
Default

I can share my ideas so long.

I should prefer to have a class where the construtor takes an integer, indicating page type as one of its parameters.

Markup validation could be another parameter e.g. an (associative) array of elements where you specify which you want to use (' ' = Blank for that markup cathegory). This API (class) should automatically test the clients browser. When an updated markup is available, only that (part of the) API should be rewritten.

Examples:
1: Naked page.
.......
.......
10: Front page with a
<table width="100%" border="0" height="100%">
with one column and three rows one for header, one for body and one for footer.
The second row of the table should again contain a new table with one row and three (four) columns, left menu, middle field(s) and right menu.

Ideally that outer table should fit 100 % to any screen. There should be no scrolling on the pages. Additional text should only be available on a similar, but not necessarily identically (since it is an internal) page through a pager class like SE SERP's (see Fuecks Vol I chapter 9). The (number of) text / menu lines should fit nicely to the body of the page and be a function of font size and the clients screen size.

Content should be supplied via class methods eg. SetFooter, SetHeader, SetLeftMenu, SetRightMenu, SetPageBody, SetPageLeftBody / SetPageRightBody ....

That content could be pulled from a database, arrays, files or code and mapped to the class methods.

Litterature inspiration:
Harry Fuecks "The PHP Anthology: Object Oriented PHP Solutions Vol I" chapter 2 and 9.
Reply With Quote
  #8 (permalink)  
Old 10-31-2006, 07:28 PM
WebProWorld Pro
 

Join Date: Sep 2005
Location: Manchester, UK
Posts: 257
mikesmith76 RepRank 0
Default

Quote:
<?xml version="1.0" encoding="iso-8859-1" ?>
Easywebdev, why the xml tag? I've seen this DOCTYPE written both with and without this. Thinking about i i suppose it should be here as this will tell the browser to treat the page more like an xml document than a html document.

Off Topic Just while i'm posting what do others think of kgun's idea of creating a page class to output common html elements. I've been toying with this idea for some time but never gotten around to implementing it. My idea was to have the class create all the necessary elements (dtd, head section, body tag etc) but none of the actual per page stuff. (This could be put in extended classes maybe. What do you all think?
Reply With Quote
  #9 (permalink)  
Old 11-02-2006, 06:51 PM
Easywebdev's Avatar
WebProWorld Veteran
 

Join Date: Apr 2004
Posts: 328
Easywebdev RepRank 1
Default

You have to include the xml prolog when you are serving the page as application/xhtml+xml. You are right, it tells the browser to handle it as an xml document.

My page class is a combination of a template and view class. The view class contains code similar to above to determine the browsers capabilities, sends appropriate headers/doctype then queries the template class for the header, body, and footer of the document when $view->display() is called. The template class is just basic variable replacement, a simple if block and a loop for displaying tabular data.

The page header, body and footer are the xhtml files with template variable placeholders for the xml prolog, doctype meta tags, page title etc.
__________________
"I have not failed. I have found 10,000 ways that don't work" - Thomas Edison.
"The secret to creativity is knowing how to hide your sources" - Albert Einstein.
Reply With Quote
  #10 (permalink)  
Old 11-08-2006, 03:09 PM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,402
kgun RepRank 3kgun RepRank 3kgun RepRank 3
Default

XHTML™ 2.0 W3C Working Draft 26 July 2006 is ready.

I am developing a new site on this.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0