You are here:  » Header already sent.

Support Forum



Header already sent.

Submitted by BobL on Mon, 2012-09-10 14:40 in

Greetings David, hope you are recovering..

I've created a new directory /policies/ and placed my policy files in them.
and added the following around those policies to pull in the template.

<div class="policy">
<?php
  require("../includes/common.php");
  require("../html/header.php");
  require("../html/user_header_after.php");
  require("../html/searchform.php");
 **** my content is here ****
    require("../html/footer.php");
require("../html/user_footer_before.php");
?>
</div>

But I'm getting an error log in the policies folder that header can not be modified, headers already sent..:(
Any idea as to what I have done wrong?
Hope I did the above correctly.

Thanks Robert

Submitted by support on Mon, 2012-09-10 15:03

Hello Robert,

Well on the mend now thank you!

The "headers already sent" warning is because html/header.php sends a character set controlling content-type header but PHP cannot send this if output has already started. All you need to do is re-structure your script slightly like this:

<?php
  require("../includes/common.php");
  require("../html/header.php");
  require("../html/user_header_after.php");
  require("../html/searchform.php");
?>
  <div class="policy">
  **** my content is here ****
  </div>
<?php
  require("../html/user_footer_before.php");
  require("../html/footer.php");
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by BobL on Mon, 2012-09-10 15:07

Bob L.

Great Service David,

Glad to hear you are doing well.

Robert