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: [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?

Re: [GB39CA] Cannot modify header information

By Donna - March 22, 2010

Hi there,

You posted a couple of different pages with the code in a variety of places -- have you tried moving the initial "STEP 1" code to the very top, with no spaces before it? This should be before everything, including the doctype declaration.

Give that a try and let me know how it works. :)
Donna

--
support@interactivetools.com