By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,939 Members | 1,638 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,939 IT Pros & Developers. It's quick & easy.

Solving script and other problems for serving true xhtml 1.1

P: n/a
I am now writing many new pages in xhtml 1.1. They are served as true
xhtml by setting the mime type of the server to application/xhtml+xml
for the .xhtml extension. Since IE6 and some earlier browsers can not
handle this mime type, a simple php include is at the very top of such
pages. If the mentioned mime type support for the viewing browser is
detected, everything above the head tag of the page is written in xhtml
1.1 code. If the browser can only support text/html, then everything
above the head tag is written in html 4.01 strict. Also a regular
expressions converts self-closed tags such as <br /> to <br> as
required for html 4.01 strict. Several methods of using such a php
script have been reported. I selected methods that work best for my

Code for media is very difficult to get to work on a variety of
browsers and also validate. See . This page has many links
that will explain how one writes the code. The WMP(Script) link will be
of most interest to this group. In an older html version of this page,
many document.writes were used in for loops to write a very large
number of divisions. This will not work when written in xhtml 1.1 and
served as mime type application/xhtml+xml. When you serve true xhtml
1.1, browsers that can handle it become very strict and parse the page
in xml. Even the smallest error, such as one unclosed tag, gives a xml
error message rather than a view of the page. However this problem is
easily solved by writing a server side php script to replace the client
side javascript that included the forbidden document.write for loops.
The browser now gets all of the divisions that are written by the
server so that the xml parser can check all of them for closed tags,
etc. Tags that are not closed are one of the major no-nos of xml. If
you use a document.write there is no telling what code it might
generate, including unclosed tags an symbols forbidden by xml. Of
course in simple cases you sometimes can use DOM methods to get around
a document.write, but in this case with so many complicated expressions
using document.write, it is much easier to use php on the server. Or
you can use Perl or other languages that you might like better.

Next view the page at
.. You may view the text of the php page at: . This page in the
original html version generated about 2500 divisions using a nest of 3
for loops with a document.write at the bottom of the nest. Of course
this will not work in true xhtml served as such. In this case nearly
all of the code is written in php at the server and downloaded when the
page is called. This is a very extreme example. However, if you have
both a Mozilla family(Mozilla, Firefox, or Netscape) and Opera browsers
in recent versions, view the page on both. You will notice that the
Mozilla family browsers show you nothing until the page is completely
downloaded. However the Opera browser shows each cell as it is
completed. Thus Opera seems to handle a long page much better than the
Mozilla family, since it allows you to see something as the code is
processed. The Mozilla family browsers also have a css bug when the
page is partly filled. The background-color used in the css style sheet
extends only to the bottom of the content of a short page, leaving the
bottom of the page white. If you use only absolute positioning, the
background-color is not displayed at all! This is easily corrected by
enclosing the whole page in a division with a background-color set in
the style for the division. This is shown in the code of some of the
pages I quoted. Opera does not have this background-color bug. From
what I have seen, Opera handles true xhtml 1.1 better than the Mozilla
family browsers. However, if I had used other pages, it is quite
possible I could have found some Opera bugs that do not apply to the
Mozilla family.

Aug 27 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a

cw****** wrote:
You may view the text of the php page at: .

If you use the IE6 browser to view this page, you will have to right
click and select show code to bring up the php code. The IE6 browser
has trouble showing text files of some php and some SMIL code.

Aug 27 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.