You are here:  » Cannot modify header information

Support Forum



Cannot modify header information

Submitted by purecountry on Tue, 2008-07-22 09:48 in

I uploaded my main folder for PT. Works fine.

Uploaded my Category folder. Followed all the instructions for doing so.

Now get this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/thelehma/public_html/shoppurecountryhiking/backpacks/html/user_header_before.php:3) in /home/thelehma/public_html/shoppurecountryhiking/backpacks/html/header.php on line 13

Copy of my header:

<?php
if ($header["title"] !="") {
  $header["title"] = str_replace("merchant:","",$header["title"]);
  $header["title"] = str_replace("category:","",$header["title"]);
  $header["title"] = str_replace("brand:","",$header["title"]);
  $header["title"] = str_replace(":"," ",$header["title"]);
}
  if (file_exists("html/user_header_before.php")) require("html/user_header_before.php");
  if ($config_charset)
  {
    header("Content-Type: text/html;charset=".$config_charset);
  }
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title><?php if (isset($header["title"]) && $header["title"]) {echo $header["title"]." - ".$config_title; } else {echo $config_title; }  ?></title>
<?php if (isset($header["meta"])): foreach($header["meta"] as $name => $content): ?>
<meta name='<?php print $name?>' content='<?php print $content?>' />
<?php endforeach; endif; ?>
<link media='all' href='<?php print $config_baseHREF?>default.css' type='text/css' rel='stylesheet' />
<link rel="alternate" type="application/rss+xml" title="RSS" href="<?php print $config_baseHREF?>rss.php" />
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<div class="main-div">
<h1 class="dnd"><a href="<?php echo $config_baseHREF?>" title="<?php echo $config_title?>"><?php echo $config_title?></a></h1>
<div id="pttemplate">
<div id="header">
<a href="<?php echo $config_baseHREF?>" title="<?php echo $config_title?>"><img src="<?php echo $config_baseHREF?>images/topimage.jpg" alt="<?php echo $config_title?>" title="<?php echo $config_title?>" height="140" width="785" /></a>
<p>[<a href="http://www.purecountryhiking.com/index.html">Home</a> ] [ <a href="http://www.purecountryhiking.com/backpacking-basics.html">Backpacking basics</a> ] [ <a href="http://www.purecountryhiking.com/drying-and-dehydrating.html">Dehydrating</a> ] [ <a href="http://www.purecountryhiking.com/wilderness-survival-guide.html">Survival</a> ] [ <a href="http://www.purecountryhiking.com/about-us.html">About Us</a> ] [ <a href="http://www.purecountryhiking.com/pure-sitemap.html">Site-map</a> ] [ <a href="http://www.purecountryhiking.com/links.html">Links</a> ] [ <a href="http://www.purecountryhiking.com/contact-us.html">Contact Us</a> ]</p>
<p class="slogan">Where the road ends and life begins</p>
</div>
<div id="main">
<div id="right"><div id="rightleft">
<?php
  if (file_exists("html/user_header_after.php")) require_once("html/user_header_after.php");
?>

Exactly the same as the main PT folder which works fine.

Category folder changes:

config.php BaseHREF /backpacks/
.htaccess BaseHREF /backpacks/

Left Nav. Shopping Home changed to hard link back to main PT folder.
Merchants link - unchanged
Brand Link - unchanged

No other changes made in files for that page.

Submitted by support on Tue, 2008-07-22 09:52

Hi,

This warning message means that your user_header_before.php generates some output, which it should not do because header.php sends. If you have PHP code in this file, make sure that there is no white space (new lines etc.) before or after the PHP tags, and it should then work fine.

However, did you perhaps mean to use user_header_after.php? You can safely generate output in user_header_after.php as the headers have been sent by this stage.

That will be all it is. If you're not sure, feel free to email me or post the content of your user_header_before.php and I'll show you where it is generating the output.

Cheers,
David.

Submitted by purecountry on Tue, 2008-07-22 10:23

Thanks David,

I don't use the user_header_before file but when I checked it it had a space. When I clicked in the middle of the page it started on the second line. Backspaced - works fine. Amazing what one little space will do.