Jump to content

Tag Closure False Positive Error


Recommended Posts

I am encountering a problem with Dreamweaver and PHP. The attached example is a simplification of the problem

 

I have a php header with the following code:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table><tr><td>
    This is my header
   </td></tr></table>
</body>
</html>

 

I then reference this in a main page using the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<p>more text goes here</p>
<p><?php include('whit_head.php');?></p>
<?php echo('test value');?>
</body>
</html>

 

I encounter the following problems. The errors are illustrated in the attached document.

The title of the whit_header.php file is some how imported leading to the "Untitled Document </head>" occurring above "This is my header". The php is also being displayed which is odd since "Live view" is not enabled.

 

The set up I am using has worked on previous websites but now it is giving this error. I have no idea what is causing this and I will appreciate any help.

 

Thank you.

 

post-164259-0-94339300-1373998670_thumb.png

post-164259-0-73998700-1373998677_thumb.png

Link to comment
Share on other sites

If this is the entire content of whit_head.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table><tr><td>
    This is my header
   </td></tr></table>
</body>
</html>

You need to get rid of everything besides what inside the body tags.  You're basically putting another <head> and <html> and body tags in side the file rather than just the html that needs to be included.  From what it looks like, you results would be like this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<p>more text goes here</p>
<p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table><tr><td>
    This is my header
   </td></tr></table>
</body>
</html>
</p>
<?php echo('test value');?>
</body>
</html>
Link to comment
Share on other sites

Thank you for your repsonses. I will give this a try.

 

I have a follow up questions. If the header is failing because of the <html><body> and other tags why have previous pages I have built with these included worked fine? Is this error a result of Dreamweaver or the other pages just wierd in some way. They follow the same pattern I posted above.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.