|
Posted by Rik Wasmus on June 3, 2008, 3:52 am
Please log in for more thread options te:
> Rik Wasmus wrote:
>
>>> Can someone offer suggestions why, on the same server (Apache =
>>> 2.2.8), this works
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
>>> <html lang=3D"en-US">
>>> <head>
>>> <link rel=3Dstylesheet type=3D"text/css" href=3D"proj_default.cs=
s"
>>> title=3D"ss_default">
>>> <title>Testing html</title>
>>> </head>
>>>
>>> <body>
>>> <script language=3D"php">
>>> include 'letters/Disclaimer';
>>> </script>
>>>
>>> <hr>
ess>
>>> <!-- Created: Wed Jan 19 10:52:50 EST 2005 -->
>>> <!-- hhmts start -->
>>> Last modified: Mon Jun 2 16:56:19 EDT 2008
>>> <!-- hhmts end -->
>>> </body>
>>> </html>
>>>
>>>
>>> but this doesn't:
>>> <?xml version=3D"1.0" encoding=3D"utf-8"?>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>> <html xmlns=3D"http://www.w3.org/1999/xhtml">
>>> <head>
>>> <title>Testing xhtml</title>
>>> <link rel=3D"stylesheet" type=3D"text/css" href=3D"proj_default.=
css"
>>> title=3D"ss_default" />
>>> <link rel=3D"icon" type=3D"image/x-icon"
>>> href=3D"images/favicon.png" />
>>> <link rel=3D"shortcut icon" type=3D"image/x-icon"
>>> href=3D"images/favicon.png" />
>>> </head>
>>>
>>> <body>
>>> <script type=3D"text/php">
>>> include 'letters/Disclaimer';
>>> </script>
>>> <hr />
ess>
>>> <!-- Created: Wed Jan 19 10:52:50 EST 2005 -->
>>> <!-- hhmts start -->
>>> Last modified: Mon Jun 2 17:37:52 EDT 2008
>>> <!-- hhmts end -->
>>> </body>
>>> </html>
>>>
>>>
>>> "Works" is defined as "the contents of letters/Disclaimer sent t=
o =
>>> the browser".
>> <script language=3D"php"> </script>
>> vs.
>> <script type=3D"text/php"> </script>
>> ... one works, the other one doesn't. Personally, I only use <?php ?=
>.
>
> "language" is not a legal attribute for XHTML <script>. (Or so says =
=
> the W3C validator.)
Indeed. However, type=3D"text/php" will not be interpreted here.
>> Besides that, as you seem to attempt XHTML, the manual states:
>> Note: Also note that if you are embedding PHP within XML or XHTML you=
=
>> will need to use the <?php ?> tags to remain compliant with standards=
.
>
> It is my understanding this means:
>
> When using PHP within XML or XHTML, the tags "<? ?>" will not
> work; instead you must use "<?php ?>".
Well, combine the fact the script tag which works is invalid in XHTML & =
=
higher versions of (strict) HTML, the obvious confusion of cwdjrxyz abou=
t =
it in the other answer, and the fact that PHP doesn't end up in the =
document, but is a processing instruction, which should be at least <? ?=
>, =
and you don't want PHP to mess with you other non-PHP processing =
instructions, I take it quite literally to mean it would be best for all=
=
concerned to use <?php ?>. Besides the fact you can have characters in a=
=
PHP script otherwise illegal in XML, and thus XHTML (&, <, >...)
> ... but I could be wrong. Do you have a pointer to documentation =
> declaring "<script>" verboten?
Nope, if I had, I would've immediatly posted it. AFAIK, you can use it, =
it =
will work, but for clarities sake I sincerely believe using <?php ?> wou=
ld =
be best for all concerned.
-- =
Rik Wasmus
...spamrun finished
|