Dreamweaver, PHP and XHTML compliance

This is a discussion on Dreamweaver, PHP and XHTML compliance within the PHP Language forums, part of the PHP Programming Forums category; Hi I'm essentially a back-end programmer so I don't know very much about Dreamweaver. However, I work ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-13-2004
Captain Nemo
 
Posts: n/a
Default 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?



Reply With Quote
  #2 (permalink)  
Old 12-13-2004
Michael Fesser
 
Posts: n/a
Default Re: Dreamweaver, PHP and XHTML compliance

.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
Reply With Quote
  #3 (permalink)  
Old 12-13-2004
Pedro Graca
 
Posts: n/a
Default Re: Dreamweaver, PHP and XHTML compliance

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!
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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




All times are GMT +1. The time now is 09:16 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0