473,231 Members | 1,634 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Dreamweaver, PHP and XHTML compliance

Hi

I'm essentially a back-end programmer so I don't know very much about
Dreamweaver. However, I work with web-designers who are keen for me to
write my pages using Dreamweaver templates.

One problem that has emerged straight away is that of XHTML compliance. I
understand (and please correct me if I'm wrong) that in order to achieve
this, every document must start with a line like:

<?xml version="1.0" encoding="iso-8859-1"?>

However, this won't work in PHP, because as soon as it sees the '<?' it
assumes that what follows is php code (and crashes).

It's simple enough to add the line:

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; ?>

at the top of your PHP pages, but then it won't work in plain HTML, so it
can't go in the template. What we need is version 1 of the line in HTML
docs and version 2 in PHP docs.

Does anyone know the answer to this problem?

Jul 17 '05 #1
3 2068
On Mon, 13 Dec 2004 13:33:47 GMT, "Captain Nemo"
<Ca*****@NoSpam.com> wrote:
One problem that has emerged straight away is that of XHTML compliance. I
understand (and please correct me if I'm wrong) that in order to achieve
this, every document must start with a line like:

<?xml version="1.0" encoding="iso-8859-1"?>

However, this won't work in PHP, because as soon as it sees the '<?' it
assumes that what follows is php code (and crashes).
[...]
Does anyone know the answer to this problem?


From what I understand, you only need to use an XML declaration if
you're serving your XHTML page as XML. Since browsers still have a
problem with that, most people serve it as text/html. So you don't
need that opening bit, and will still be standards compliant.
Here's further reading from the W3C:

http://www.w3.org/International/tuto...enc/#declaring

Ian
--
http://www.sundry.ws/
http://www.bookstacks.org/
Jul 17 '05 #2
.oO(Captain Nemo)
I'm essentially a back-end programmer so I don't know very much about
Dreamweaver. However, I work with web-designers who are keen for me to
write my pages using Dreamweaver templates.

One problem that has emerged straight away is that of XHTML compliance. I
understand (and please correct me if I'm wrong) that in order to achieve
this, every document must start with a line like:

<?xml version="1.0" encoding="iso-8859-1"?>
Nope. While the XML prolog is recommended, it's not always necessary.
It's used to specify the used encoding, but this can/should also be done
in the response header sent by the server (with a charset parameter in
the content-type header). Additionally using such a prolog will kick
Internet Explorer into quirks mode.
However, this won't work in PHP, because as soon as it sees the '<?' it
assumes that what follows is php code (and crashes).
That's because short_open_tags are enabled on the server.
It's simple enough to add the line:

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; ?>
Ugly.

I would rather turn short_open_tags off (along with register_globals and
magic_quotes_gpc).
at the top of your PHP pages, but then it won't work in plain HTML, so it
can't go in the template. What we need is version 1 of the line in HTML
docs and version 2 in PHP docs.

Does anyone know the answer to this problem?


First you should ask the designers why they insist on using XHTML.
HTML 4.01 Strict is more than enough in most cases unless you know
exactly what you're doing. Currently there's little to no reason to use
XHTML. Only the most recent browsers like Opera and Mozilla really
support it, for others like IE you have to deliver it as text/html,
which makes no sense at all and may cause new problems.

Sending XHTML as text/html Considered Harmful
http://hixie.ch/advocacy/xhtml

Micha
Jul 17 '05 #3
Captain Nemo wrote:
However, this won't work in PHP, because as soon as it sees the '<?' it
assumes that what follows is php code (and crashes).

It's simple enough to add the line:

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; ?>

at the top of your PHP pages, but then it won't work in plain HTML, so it
can't go in the template. What we need is version 1 of the line in HTML
docs and version 2 in PHP docs.

Does anyone know the answer to this problem?


You could try "short_open_tag = off"
http://www.php.net/manual/en/ini.sec...short-open-tag

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.