Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > XHTML and PHP?

Reply
Thread Tools

XHTML and PHP?

 
 
John Salerno
Guest
Posts: n/a
 
      01-27-2006
I got the following error message when I tried to use a PHP include() in
my XHTML file:

------
PHP Parse error: syntax error, unexpected T_STRING in
C:\Domains\johnjsal.com\wwwroot\g_camera_move.php on line 1
------

The top of my html file is:

-------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>........
-------

Is something in this heading causing a problem? I removed the first line
but still got the same message. Then I created a new HTML page with no
heading at all (I started with the <html> tag) and the include() worked.

So obviously something about my heading is causing problems, but I don't
understand what it is.
 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      01-27-2006
John Salerno wrote:

> <?xml version="1.0" encoding="utf-8"?>


Replace this with:

<?= '<?xml version="1.0" encoding="utf-8"?>'."\n" ?>

(or remove it altogether -- it's optional, and pushes IE/win into quirks
mode)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
 
 
 
John Salerno
Guest
Posts: n/a
 
      01-27-2006
Toby Inkster wrote:
> John Salerno wrote:
>
>> <?xml version="1.0" encoding="utf-8"?>

>
> Replace this with:
>
> <?= '<?xml version="1.0" encoding="utf-8"?>'."\n" ?>
>
> (or remove it altogether -- it's optional, and pushes IE/win into quirks
> mode)
>


Well, I could have sworn I tried this already and it didn't work, but
now it does. Thanks!

Btw, what does that first option do, with <?= ?> ?
 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      01-27-2006
John Salerno wrote:

> <?= ?>


<?= X ?>

is shorthand for

<?php echo X; ?>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Mike Massonnet
Guest
Posts: n/a
 
      01-27-2006
Toby Inkster wrote:

> John Salerno wrote:
>
>> <?xml version="1.0" encoding="utf-8"?>

>
> Replace this with:
>
> <?= '<?xml version="1.0" encoding="utf-8"?>'."\n" ?>
>
> (or remove it altogether -- it's optional, and pushes IE/win into quirks
> mode)
>


it is also optional when using UTF-8 or UTF-16 encoding.

--
je bavarde de ce que je veux
-+- CF in Guide du Fmblien Assassin : bien configurer son bavardage -+-

 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      01-28-2006
Mike Massonnet wrote:

> it is also optional when using UTF-8 or UTF-16 encoding.


Or indeed ASCII, as that is a subset of UTF-8.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Alan J. Flavell
Guest
Posts: n/a
 
      01-28-2006

On Sat, 28 Jan 2006, Toby Inkster wrote:

> Mike Massonnet wrote:
>
> > it is also optional when using UTF-8 or UTF-16 encoding.

>
> Or indeed ASCII, as that is a subset of UTF-8.


It's quite amusing really: if you send content which is strictly
us-ascii, undeclared, over HTTP, then RFC2616 says it should be
assumed to be iso-8859-1, while XML can assume it's utf-8, and neither
of them are actually wrong :-}

This is not really advisable, though. Depending on the contents of
the ASCII data stream, MSIE might unilaterally decide that it's utf-7,
and CERT CA-2000-02 warns about cross-site scripting security flaws
which can be exploited. An appropriate explict encoding should always
be advertised, as the CERT alert recommends.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs XML 0 08-02-2011 05:40 AM
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs C Programming 0 08-01-2011 06:29 AM
convert xhtml to another xhtml using xslt Usha2009 XML 0 12-20-2009 01:13 PM
Should I Convert Site To XHTML or XHTML mobile? chronos3d HTML 9 12-05-2006 04:46 PM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM



Advertisments