Multiple body tags result in multiple headers and footers

Marc Hodgins <[email protected]> Thu, 28 Jun 2007 21:48:37 -0600
Newsgroups gmane.comp.apache.mod-layout
Message-ID <[email protected]>
Hi there,

I'm attempting to implement mod_layout on a machine running apache2 and 
mod_layout 4.1, using the following directives:

AddOutputFilter LAYOUT php
ScriptAlias /share/ "/usr/share/php/"
LayoutHeader /share/mod_layout/header.php
LayoutFooter /share/mod_layout/footer.php

The trouble is, on some pages, there are multiple <body></body> tags 
within the code.. the multiple body tags aren't all written to the final 
output, but they're included in the PHP code.  These are third party 
applications deployed on hundreds of sites that we host, so I cannot 
change them.  A simple example:

<?php
if ($_GET['s']=='home') {
    echo <<<EOT
<body>home page</body>
EOT;
} else {
   echo <<<EOT
<body>another page</body>
EOT;
}
?>

mod_layout sees each <body> tag and inserts multiple headers and footers....

Have I implemented mod_layout incorrectly?  Internally, shouldn't 
mod_layout catch only the first and last <body> tag?  Is there any way I 
can work around this?

Thanks,
Marc