Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 1:52 pm (All times are UTC )

 


Forum rules

Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.



Post new topic Reply to topic  [ 14 posts ] 
Author Message
Posted: Thu Sep 15, 2005 11:27 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Fri Aug 19, 2005 5:23 pm
Posts: 553
Location: Gogledd Cymru
The templates that came with $ambo 4.5.2 all dish out a tag before the tag.

According to the  XHTML recomendation at w3c.org (http://www.w3.org/TR/xhtml1/):

"An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol."

Having the xml tag before the doctype appears to stop MSIE 6.0 from going into strict standards mode for some reason.  As soon as I removed it my DIV/CSS based layouts all starting behaving perfectly in MSIE and Firefox - before I took it out I'd been forced to resort to using tables!

Do people generally leave it in their templates?  Anyone else experienced layout problems that could be caused by this behaviour?  Is it something odd about my setup?

Geraint

_________________
email: opensourcematters at copynDOTplusDOTcom


Top
  E-mail  
 
Posted: Thu Sep 15, 2005 11:32 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Fri Aug 19, 2005 5:23 pm
Posts: 553
Location: Gogledd Cymru
Support for my argument :

http://blogs.msdn.com/ie/archive/2005/0 ... spx#446451

_________________
email: opensourcematters at copynDOTplusDOTcom


Top
  E-mail  
 
Posted: Thu Sep 15, 2005 11:53 am 
I've been banned!
Offline

Joined: Thu Aug 18, 2005 12:37 am
Posts: 1139
Location: Melbourne, Australia
I recommend people remove it.

XML before the Doctype just causes hassles for cross browser compliance.

That said, I do have an awful lot of legacy templates that don't conform to this, however, I am going through and revising them..


Top
  E-mail  
 
Posted: Thu Sep 15, 2005 12:59 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Thu Aug 18, 2005 4:35 pm
Posts: 2838
Location: Cheshire, England
I raised this back on the old forum http://forum.mamboserver.com/showthread.php?t=55617

complete with a little demo for people with IE to see the difference it can make to your layout e.g. box model sizing and support for e.g. margin: auto; to center a page.

The demo: http://www.webxite.plus.com/xmlbefore.html

There was not really any feedback on what problems forcing I.E. into standards mode may cause for older browsers.

It sure makes it easier to create sites which work in both I.E.6 and Firefox without resorting to hacks / workarounds.

_________________
Look at the page source... Lots of useful info...


Top
   
 
Posted: Thu Sep 15, 2005 1:55 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Fri Aug 19, 2005 5:23 pm
Posts: 553
Location: Gogledd Cymru
It would be trivial for the templates shipped with Joomla to have a conditional statement before the doctype tag - if the iso encoding is something other than  UTF-8 or UTF-16 then show the xml tag otherwise do not.

There's an interesting dicussion, albeit a bit dated, at http://www.webmasterworld.com/forum88/2256.htm.

One problem with switching to UTF-8 encoding throughout is that some of the keys in the MySQL database are then two long (I discovered this trying to restore a database backup using (MySQL Administrator).  The backup had been saved as UTF-8 by default and then it barffed when I tried up restore the DB again!  If I get the chance I'll try to repeat the exercise to see which the offending tables where (of course they may have been from a 3rd party component and non Joomla!).

Geraint

_________________
email: opensourcematters at copynDOTplusDOTcom


Top
  E-mail  
 
Posted: Sat Jan 07, 2006 5:34 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Oct 25, 2005 12:19 am
Posts: 14
Location: Vinita, OK
According to http://www.quirksmode.org/css/quirksmode.html -
Quote:
In Explorer 6 Windows, Microsoft implemented one extra rule: if a doctype that triggers strict mode is preceded by an xml prolog, the page shows in quirks mode. This was done to allow web developers to achieve valid pages (which require a doctype) but nonetheless stay in quirks mode.


That means that if you want it to keep that XML prolog, yet stay in standards compliance mode, you simply switch the doctype to a Transitional doctype. if it's already valid strict, should just be the change of a word and a URL (sometimes).

_________________
Most people just don't know what's wrong with their websites. They don't even know they don't know! I'm glad to educate those people.


Top
   
 
Posted: Tue Jan 10, 2006 10:12 am 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Sep 12, 2005 5:23 am
Posts: 167
Location: Stockholm, Sweden
Code:
Hi again! Just a (hopefully) final question:

I have been following the continued discussion regarding the order of the xml declaration and dtd with regards to IE6. The index.php file for rhuk_solarflare begins somewhat different than the examples I have seen illustrating the issue:

[code]<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );
// needed to seperate the ISO number from the language file constant _ISO
$iso = explode( '=', _ISO );
// xml prolog
echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php mosShowHead(); ?>
<?php[/code]

To implement the suggested method the code above, should:

- I drop

[code][/code]// xml prolog
echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';


alltogether?

- I move the dtd to the very top, i.e. before

Code:
<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );
??

I would be most grateful if anyone cared to clarify this!!


Top
  E-mail  
 
Posted: Tue Jan 10, 2006 10:24 am 
I've been banned!
Offline

Joined: Thu Aug 18, 2005 12:37 am
Posts: 1139
Location: Melbourne, Australia
It's easier just to leave the DTD after the 'access or die' PHP statements, from where I stand.

That way, you know which bits of your template do what, instead of having each piece of functionality spread over many different area.


Top
  E-mail  
 
Posted: Wed Feb 01, 2006 10:48 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Dec 15, 2005 10:18 am
Posts: 54
Location: Brussels
This is a very interesting topic. I also found the tutorial on Joomlaya (http://www.joomlaya.com/content/view/221/83/) and I immediately checked the declaration in my own template and found a line before the doctype declaration:

';?>



Moving this piece of code completely ruins my page layout. So I left it there.

Geraint posted the following link to a message in IEBlog:
Geraint wrote:


But there was an interesting answer to this post: http://blogs.msdn.com/ie/archive/2005/07/29/445242.aspx#446507. So it seems that it doesn't really matter if the doctype declaration is not the first line in the code.

What is the conclusion? Should the doctype declaration be the first line? If so, what should happen to the XML declaration of the index.php template to avoid it from ruining the design??

_________________
> Kinne <


Last edited by kinne on Wed Feb 01, 2006 10:51 am, edited 1 time in total.

Top
  E-mail  
 
Posted: Thu Feb 02, 2006 11:49 am 
I've been banned!
Offline

Joined: Thu Aug 18, 2005 12:37 am
Posts: 1139
Location: Melbourne, Australia
kinne wrote:
This is a very interesting topic. I also found the tutorial on Joomlaya (http://www.joomlaya.com/content/view/221/83/) and I immediately checked the declaration in my own template and found a line before the doctype declaration:

';?>



Moving this piece of code completely ruins my page layout. So I left it there.

Geraint posted the following link to a message in IEBlog:
Geraint wrote:


But there was an interesting answer to this post: http://blogs.msdn.com/ie/archive/2005/07/29/445242.aspx#446507. So it seems that it doesn't really matter if the doctype declaration is not the first line in the code.

What is the conclusion? Should the doctype declaration be the first line? If so, what should happen to the XML declaration of the index.php template to avoid it from ruining the design??


There are actually 4 seperate code sequences inside the above code:

The 'access or die' statement, to secure the template:
Code:
defined( "_VALID_MOS" ) or die( "Direct Access to this location is not allowed." );


The ISO language call:
Code:
$iso = split( '=', _ISO );


The XML prolog call:
Code:
echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';


and the Doctype:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


What you need to do to force IE to conform to standards is remove the XML prolog call, and since the ISO call is dependent on the XML prolog, you may as well remove that too!

It's entirely understandable that removing the entire first line combination ('access or die, ISO and XML prolog') will cause your template to not work. As for the rest of your questions, it's better to leave the 'access or die' statement as the first line as it secures all of your template. You then follow that statement with the doctype, at which point IE renders in standards compliance mode.


Last edited by absalom on Fri Feb 03, 2006 8:26 am, edited 1 time in total.

Top
  E-mail  
 
Posted: Fri Feb 03, 2006 8:57 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Dec 15, 2005 10:18 am
Posts: 54
Location: Brussels
[quote=∓quot;absalom"\]
It's entirely understandable that removing the entire first line combination ('access or die, ISO and XML prolog') will cause your template to not work. As for the rest of your questions, it's better to leave the 'access or die' statement as the first line as it secures all of your template. You then follow that statement with the doctype, at which point IE renders in standards compliance mode.
[/quote]

Thank you for this answer.
I did what you suggested, but excet the ISO part of the code, removinig any of the other parts completely ruins the display (menu is not floated left, wrapper is not taken into account,...)
So I left the code as is for now...

_________________
> Kinne <


Top
  E-mail  
 
Posted: Thu Dec 20, 2007 8:09 am 
I've been banned!
Offline

Joined: Wed Dec 19, 2007 10:36 pm
Posts: 20
just take it out, most if not all browsers will not be effected by this small code.

_________________
smile


Top
  E-mail  
 
Posted: Mon Jan 26, 2009 6:06 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Wed Feb 07, 2007 10:09 pm
Posts: 90
IE doesn't work with this small piece of code.

_________________
Dnevni horoskop | Daily horoscope


Top
  E-mail  
 
Posted: Wed Apr 22, 2009 8:42 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Apr 22, 2009 7:13 am
Posts: 1
I agree this doesnt help with IE

_________________
http://www.aupairjobs.org


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

Quick reply

 



Who is online

Users browsing this forum: agiercke and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group