Cannot modify header information

9 posts by 4 authors in: Forums > CMS Builder
Last Post: March 22, 2010   (RSS)

By Active1965 - March 18, 2010

Hi Guys

When I create generated code , I Insert it into my html page but I keep getting this error, when the page is live, I have deletd <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> but no matte what I do I still get the error





Warning: Cannot modify header information - headers already sent by (output started at /home/k7mmg8tt/public_html/demo/heating_photos.htm:8) in /home/k7mmg8tt/public_html/demo/heating_photos.htm on line 93 Record not found!

Thanks
GB

Re: [GB39CA] Cannot modify header information

By Chris - March 18, 2010

Hi GB,

Can you please attach the complete PHP source code for your page?
All the best,
Chris

Re: [chris] Cannot modify header information

By Active1965 - March 19, 2010

Hi Chris

Please see below - thanks



<html>
<head>
<title></title>

<link rel="stylesheet" href="css.css" type="text/css">
<link rel="stylesheet" href="css2.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>

<body style="background: url(bg.jpg) fixed;" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#000000" link="#000000" vlink="#000000" alink="#000000">
<table width="980" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF" class="bordermain">
<tr>
<td colspan="2" height="185" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="980" height="112" valign="top"><img src="boilers_r1_c1.jpg" width="980" height="112" alt="Pellet Boiler Solar Heating Systems"></td>
</tr>
<tr>
<td height="25" valign="top"><img src="boilers_r2_c1.jpg" width="426" height="23"><a href="index.htm"><img src="boilers_r2_c5.jpg" width="76" height="23" alt="Home" border="0"></a><a href="downloads.htm"><img src="boilers_r2_c7.jpg" width="105" height="23" alt="Downloads" border="0"></a><a href="grants.htm"><img src="boilers_r2_c9.jpg" width="90" height="23" alt="Grants" border="0"></a><a href="photo_gallery.htm"><img src="boilers_r2_c11.jpg" width="115" height="23" alt="Photo Gallery" border="0"></a><a href="contact_us.htm"><img src="boilers_r2_c13.jpg" width="168" height="23" alt="Contact Us" border="0"></a></td>
</tr>
<tr>
<td height="48" valign="top"><a href="pellet_boiler_systems.htm"><img src="boilers_r3_c1.jpg" width="160" height="48" alt="Pellet Boilers" border="0"></a><a href="gas_boilers.htm"><img src="boilers_r3_c2.jpg" width="148" height="48" alt="Gas Boilers" border="0"></a><a href="oil_boilers.htm"><img src="boilers_r3_c4.jpg" width="140" height="48" alt="Oil Burners" border="0"></a><a href="heat_recovery_systems.htm"><img src="boilers_r3_c6.jpg" width="132" height="48" alt="Heat Recovry" border="0"></a><a href="solar_power_systems.htm"><img src="boilers_r3_c8.jpg" width="86" height="48" alt="Solar Systems" border="0"></a><a href="heating_controls.htm"><img src="boilers_r3_c10.jpg" width="89" height="48" alt="Heating Controls" border="0"></a><a href="underfloor_heating_systems.htm"><img src="boilers_r3_c12.jpg" width="104" height="48" alt="Underfloor Heating" border="0"></a><a href="grants.htm"><img src="boilers_r3_c14.jpg" width="121" height="48" alt="Grants" border="0"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="222" height="681" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="222" height="9"></td>
</tr>
<tr>
<td height="168" valign="top">
<table width="75%" border="0">
<tr>
<td><a href="grants.htm"><img src="images/menu_r1_c1.jpg" width="212" height="34" alt="Energy Grants" border="0"></a></td>
</tr>
<tr>
<td><a href="downloads.htm"><img src="images/menu_r2_c1.jpg" width="212" height="35" alt="Downloads" border="0"></a></td>
</tr>
<tr>
<td><a href="photo_gallery.htm"><img src="images/menu_r3_c1.jpg" width="212" height="36" alt="Photo Gallery" border="0"></a></td>
</tr>
<tr>
<td><a href="ber_certs.htm"><img src="images/ber.jpg" width="212" height="33" alt="BER Certs" border="0"></a></td>
</tr>
<tr>
<td><a href="contact_us.htm"><img src="images/menu_r4_c1.jpg" width="212" height="35" alt="Contact Us" border="0"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="9"></td>
</tr>
<tr>
<td height="495" valign="top"><img src="images/menu_r5_c1.jpg" width="212" height="495" alt="Suppliers"></td>
</tr>
</table>
</td>
<td width="758" rowspan="2" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="14" height="15"></td>
<td width="734"></td>
<td width="11"></td>
</tr>
<tr>
<td height="191"></td>
<td valign="top">
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/home/k7mmg8tt/public_html/cmsAdmin/lib/viewer_functions.php";

list($underfloor_heatingRecords, $underfloor_heatingMetaData) = getRecords(array(
'tableName' => 'underfloor_heating',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$underfloor_heatingRecord = @$underfloor_heatingRecords[0]; // get first record

// show error message if no matching record is found
if (!$underfloor_heatingRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>


<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Underfloor Heating - Detail Page Viewer</h1>
<br/>
<?php echo $underfloor_heatingRecord['title'] ?>
<br/>
<?php echo $underfloor_heatingRecord['content'] ?>
<br/>
<br/>
<hr/>
<?php if (!$underfloor_heatingRecord): ?>
No record found!<br/>
<br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
</td>
<td></td>
</tr>
<tr>
<td height="501"></td>
<td></td>
<td></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="26"></td>
</tr>
<tr>
<td height="99" colspan="2" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bottom.jpg">
<tr>
<td width="44" height="16"></td>
<td width="915"></td>
<td width="21"></td>
</tr>
<tr>
<td height="71"></td>
<td valign="top">
<div align="center">
<table width="100%" border="0">
<tr>
<td height="51">
<div align="center" class="css"><a href="index.htm">Home</a>
| <a href="pellet_boiler_systems.htm">Pellet Boiler Systems</a>
| <a href="gas_boilers.htm">Gas Condensing Boilers</a> |
<a href="heat_recovery_systems.htm">Heat Recovery &amp;
Ventilation</a> | <a href="solar_power_systems.htm">Solar
Systems</a> | <a href="heating_controls.htm">Heating Controls</a>
|<a href="underfloor_heating_systems.htm">Underfloor Heating</a>
| <a href="grants.htm">Grants</a> | <a href="downloads.htm">Downloads</a>
|<a href="photo_gallery.htm"> Photo Gallery</a> |<a href="privacy.htm">Privacy
Policy</a> | <a href="legal.htm">Website Legal Statement</a>|
<a href="ber_certs.htm">BER Certificates</a> | <a href="contact_us.htm">Contact
Us</a></div>
</td>
</tr>
<tr>
<td>
<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#003300">&copy;2010
Kearns Heating &amp; Plumbling</font></div>
</td>
</tr>
</table>

</div>
</td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Re: [GB39CA] Cannot modify header information

By Active1965 - March 19, 2010

Hi Chris



I got it sorted - removed the 'Content-type: text/html; charset=utf-8' and it works fine - Thanks[/#000000]

Re: [GB39CA] Cannot modify header information

By Chris - March 19, 2010

Hi GB,

Great to hear you got this sorted out.

Usually I have to move my PHP to the very top of the page to fix these kinds of problems (i.e. even before <html>.)

Take care!
All the best,
Chris

Re: [GB39CA] Cannot modify header information

By Active1965 - March 19, 2010

Hi Chris

The problem is back , not sure what to remove to get it working, here is the code below, when I upload the page I get the error



<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">

<table width="1075" border="0" cellpadding="0" cellspacing="0" mm:layoutgroup="true">
<tr>
<td width="138" height="223"></td>
<td width="937"></td>
</tr>
<tr>
<td height="176"></td>
<td valign="top">
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/home/k7mmg8tt/public_html/cmsAdmin/lib/viewer_functions.php";

list($ber_certificatesRecords, $ber_certificatesMetaData) = getRecords(array(
'tableName' => 'ber_certificates',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$ber_certificatesRecord = @$ber_certificatesRecords[0]; // get first record

// show error message if no matching record is found
if (!$ber_certificatesRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- INSTRUCTIONS -->
<div class="instructions"> <b>Sample Detail Page Viewer - Instructions:</b>
<ol>
<?php ?>
<li><b>Remove any fields you don't want displayed.</b></li>
<li>Rearrange remaining fields to suit your needs.</li>
<li>Copy and paste code into previously designed page (or add design
to this page).</li>
</ol>
</div>
<!-- /INSTRUCTIONS -->
<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>BER Certificates - Detail Page Viewer</h1>
Record Number:
<?php echo $ber_certificatesRecord['num'] ?>
<br/>
Title:
<?php echo $ber_certificatesRecord['title'] ?>
<br/>
Content:
<?php echo $ber_certificatesRecord['content'] ?>
<br/>
_link : <a href="<?php echo $ber_certificatesRecord['_link'] ?>">
<?php echo $ber_certificatesRecord['_link'] ?>
</a><br/>
<!-- STEP 2a: Display Uploads for field 'gz48f' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($ber_certificatesRecord['gz48f'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download
<?php echo $upload['filename'] ?>
</a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
<hr/>
<?php if (!$ber_certificatesRecord): ?>
No record found!<br/>
<br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
<a href="<?php echo $ber_certificatesMetaData['_listPage']; ?>">&lt;&lt;
Back to list page</a> - <a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email
this Page</a> </td>
</tr>
</table>
</body>
</html>

Re: [GB39CA] Cannot modify header information

By Active1965 - March 22, 2010

Hi Chris

Maybe you can take a look at this code, when I paste it into my html page and upload it , I get this error

Warning: Cannot modify header information - headers already sent by (output started at /home/k7mmg8tt/public_html/demo/underfloor_photos.htm:7) in /home/k7mmg8tt/public_html/demo/underfloor_photos.htm on line 79
Warning: Cannot modify header information - headers already sent by (output started at /home/k7mmg8tt/public_html/demo/underfloor_photos.htm:7) in /home/k7mmg8tt/public_html/demo/underfloor_photos.htm on line 93 Record not found!









Here is my code




<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/home/k7mmg8tt/public_html/cmsAdmin/lib/viewer_functions.php";

list($gallery_underfloor_heatingRecords, $gallery_underfloor_heatingMetaData) = getRecords(array(
'tableName' => 'gallery_underfloor_heating',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$gallery_underfloor_heatingRecord = @$gallery_underfloor_heatingRecords[0]; // get first record

// show error message if no matching record is found
if (!$gallery_underfloor_heatingRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>
<!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>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>
<body>

<!-- INSTRUCTIONS -->
<div class="instructions">
<b>Sample Detail Page Viewer - Instructions:</b>
<ol>
<?php ?>
<li><b>Remove any fields you don't want displayed.</b></li>
<li>Rearrange remaining fields to suit your needs.</li>
<li>Copy and paste code into previously designed page (or add design to this page).</li>
</ol>
</div>
<!-- /INSTRUCTIONS -->

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Gallery Underfloor Heating - Detail Page Viewer</h1>
Record Number: <?php echo $gallery_underfloor_heatingRecord['num'] ?><br/>
Title: <?php echo $gallery_underfloor_heatingRecord['title'] ?><br/>
Content: <?php echo $gallery_underfloor_heatingRecord['content'] ?><br/>
_link : <a href="<?php echo $gallery_underfloor_heatingRecord['_link'] ?>"><?php echo $gallery_underfloor_heatingRecord['_link'] ?></a><br/>


<!-- STEP 2a: Display Uploads for field 'gallery_photos' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($gallery_underfloor_heatingRecord['gallery_photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->


<hr/>
<?php if (!$gallery_underfloor_heatingRecord): ?>
No record found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->

<a href="<?php echo $gallery_underfloor_heatingMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a> -
<a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
</body>
</html>


Thanks
GB

Re: [GB39CA] Cannot modify header information

By flamerz - March 22, 2010

I had similar problems when my editor converted my unix file to msdos type.

can be this? what editor do you use?