Click here to get back home

problem including files under xhtml

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
problem including files under xhtml Robert Huff 06-02-2008
Get Chitika Premium
Posted by Robert Huff on June 2, 2008, 6:16 pm
Please log in for more thread options
        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="en-US">
<head>
        <link rel=stylesheet type="text/css" href="proj_default.css"
         title="ss_default">
<title>Testing html</title>
</head>

<body>
<script language="php">
include 'letters/Disclaimer';
</script>

<hr>
<!-- 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="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <title>Testing xhtml</title>
        <link rel="stylesheet" type="text/css" href="proj_default.css"
                 title="ss_default" />
        <link rel="icon" type="image/x-icon"
                href="images/favicon.png" />
        <link rel="shortcut icon" type="image/x-icon"
                href="images/favicon.png" />
</head>

<body>
<script type="text/php">
include 'letters/Disclaimer';
</script>
<hr />
<!-- 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 to the
browser".
        Respectfully,


                                Robert Huff



                        

Posted by Rik Wasmus on June 2, 2008, 6:29 pm
Please log in for more thread options
te:
>         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.css"
>          title=3D"ss_default">
> <title>Testing html</title>
> </head>
>
> <body>
> <script language=3D"php">
> include 'letters/Disclaimer';
> </script>
>
> <hr>
s>
> <!-- 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 />
s>
> <!-- 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 to 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 ?>.

Besides that, as you seem to attemp XHTML, the manual states:
Note: Also note that if you are embedding PHP within XML or XHTML you wi=
ll =

need to use the <?php ?> tags to remain compliant with standards.
-- =

Rik Wasmus
...spamrun finished

Posted by Robert Huff on June 2, 2008, 11:06 pm
Please log in for more thread options
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="en-US">
>> <head>
>> <link rel=stylesheet type="text/css" href="proj_default.css"
>> title="ss_default">
>> <title>Testing html</title>
>> </head>
>>
>> <body>
>> <script language="php">
>> include 'letters/Disclaimer';
>> </script>
>>
>> <hr>
>> <!-- 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="1.0" encoding="utf-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <title>Testing xhtml</title>
>> <link rel="stylesheet" type="text/css" href="proj_default.css"
>> title="ss_default" />
>> <link rel="icon" type="image/x-icon"
>> href="images/favicon.png" />
>> <link rel="shortcut icon" type="image/x-icon"
>> href="images/favicon.png" />
>> </head>
>>
>> <body>
>> <script type="text/php">
>> include 'letters/Disclaimer';
>> </script>
>> <hr />
>> <!-- 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 to
>> the browser".
>
> <script language="php"> </script>
> vs.
> <script type="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.)

> 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 ?>".

        ... but I could be wrong. Do you have a pointer to documentation
declaring "<script>" verboten?


                                Robert Huff

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

Posted by Robert Huff on June 3, 2008, 12:12 pm
Please log in for more thread options
Rik Wasmus wrote:

>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
>>>> <html lang="en-US">
>>>> <head>
>>>> <link rel=stylesheet type="text/css" href="proj_default.css"
>>>> title="ss_default">
>>>> <title>Testing html</title>
>>>> </head>
>>>>
>>>> <body>
>>>> <script language="php">
>>>> include 'letters/Disclaimer';
>>>> </script>

> Well, combine the fact the script tag which works is invalid in XHTML &
> higher versions of (strict) HTML,

        If that's true, then why does that (portion of the file) validate?
(I know about the open text at the bottom; it's a different issue.)


                        Robert Huff

Similar ThreadsPosted
including files August 13, 2005, 2:34 pm
including files - paths April 15, 2005, 8:45 am
Including files that have query strings January 22, 2005, 12:25 am
require_once(), seemingly including files more then once. August 10, 2005, 1:26 pm
2 methods of including files sequence June 23, 2007, 1:21 pm
phpthumb - html/xhtml validation problem August 15, 2006, 10:42 am
problem while including two scripts... December 29, 2005, 12:28 am
Problem including the other php file. June 8, 2007, 11:07 am
Problem with XHTML parsers with embedded HTML (e.g. firefox et-al) November 4, 2004, 6:28 am
Problem in uploading files in php 4.5 December 19, 2004, 11:50 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap