Re: problem with "include" directive under XHTML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Huff wrote:
	I'm working on a project that involves converting HTML to
XHTML.  Not strictly sure this is a PHP issue, but testing (so far)
has eliminated other possibilities.

	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>
<address><a href="mailto:roberthuff@xxxxxxx";>Robert Huff</a></address>
<!-- 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 />
<address><a href="mailto:roberthuff@xxxxxxx";>Robert Huff</a></address>
<!-- 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>


	
	Rspectfully,


				Robert Huff



According to W3Schools (http://www.w3schools.com/TAGS/tag_script.asp) "text/php" is not a valid type for a script tag. I was never aware of it ever being a valid type for that matter - I would expect the browser to be very confused when it saw that and attempt to parse it as something like Javascript (Which makes me wonder why it even worked at all as I can't find anything about an include function built into Javascript itself).

I'd just try this instead, renaming the file to have .php as it's extension so that your server parses it as PHP.

<?php
include('letters/Disclaimer');
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux