Cannot modify header information?
Cannot modify header information?
Script URL: http://www.davereederdesign.com/gbook/gbook.php
Version of script: 1.34 from 16th November 2005
Version of PHP: 4
Hosting company: 34SP.com
Write your message below:
Hi folks. I get "Cannot modify header information" on my guestbook page as above.
I didnt get this until I added the xhtml to integrate the gbook into my site. Before I added the xhtml it was fine and I successfully made a guestbook entry.
So what I dont understand is, why do I get these header errors, I cant see anything in the xhtml that might mess with those.
Im using xhtml 1.1, is that a problem?
Thanks for the advice!
Version of script: 1.34 from 16th November 2005
Version of PHP: 4
Hosting company: 34SP.com
Write your message below:
Hi folks. I get "Cannot modify header information" on my guestbook page as above.
I didnt get this until I added the xhtml to integrate the gbook into my site. Before I added the xhtml it was fine and I successfully made a guestbook entry.
So what I dont understand is, why do I get these header errors, I cant see anything in the xhtml that might mess with those.
Im using xhtml 1.1, is that a problem?
Thanks for the advice!
Hello drd,
From what i could see at your page you have modified the original 1.34 script by Klemen to xhtml yourself.
My guess is you have made a typo when you modified all the code in the gbook.php file to valid xhtml but i don't know for sure.
The errors are produced by lines 720 thru 723 of your gbook.php file. If you could post these lines here i can have a look and maybe find out what the error is.
I don't know if you have looked at the forums, but at the GBook - guestbook add-ons forum i have posted a fully to valid xhtml 1.1 converted version of the Gbook 1.34 guestbook.
It has a lot more options (which make it a little harder to set up) but if you want valid xhtml this could be an option to use instead of your own modified guestbook.
Greetings,
Henrie
From what i could see at your page you have modified the original 1.34 script by Klemen to xhtml yourself.
My guess is you have made a typo when you modified all the code in the gbook.php file to valid xhtml but i don't know for sure.
The errors are produced by lines 720 thru 723 of your gbook.php file. If you could post these lines here i can have a look and maybe find out what the error is.
I don't know if you have looked at the forums, but at the GBook - guestbook add-ons forum i have posted a fully to valid xhtml 1.1 converted version of the Gbook 1.34 guestbook.
It has a lot more options (which make it a little harder to set up) but if you want valid xhtml this could be an option to use instead of your own modified guestbook.
Greetings,
Henrie
Hi Henrie,
Thanks for the reply.
I downloaded your latest version from the add-ons forum.
It was all working nicely until I added the XHTML from my webpage to the beginning and end of the gbook.php file.
I get the same error:
http://www.davereederdesign.com/gbook/gbook.php
Something in my XHTML is messing with the gbook code to cause this header error.
So, I removed my link to my stylesheet as the stylesheet is specified in the settings file.
Now I get a pas error:
http://www.davereederdesign.com/gbook/gbook.php
Dont know what Im doing...
Thanks for the reply.
I downloaded your latest version from the add-ons forum.
It was all working nicely until I added the XHTML from my webpage to the beginning and end of the gbook.php file.
I get the same error:
http://www.davereederdesign.com/gbook/gbook.php
Something in my XHTML is messing with the gbook code to cause this header error.
So, I removed my link to my stylesheet as the stylesheet is specified in the settings file.
Now I get a pas error:
http://www.davereederdesign.com/gbook/gbook.php
Dont know what Im doing...

Hello drd,
The gbook.php file is not meant to be edited by someone who does not how it works.
Place your own code in the header.txt and footer.txt files included in the gbook zip file. This way code can be placed at the beginning of the <body> tag before start of the guestbook code (header.txt) and just before the </body> tag after the end of the guestbook code (footer.txt) file.
Because you have added your own code, now two <head>...</head><body> parts exist in the code presented to the browser where this part should exist only ones. View the source code from your browser to check your page (not only in the program you code with).
If you want to add your own headers and footers, you have to replace the code in the gbook.php file with you own code (not add it).
In the gbook.php version 1.34 the headers start at line 619 (function printTopHTML() {)
The footer starts at line 641 (function printDownHTML() {)
In the gbook.php version 1.34 HL.03 the headers start at line 777 (function printTopHTML() {)
The footer starts at line 825 (function printDownHTML() {)
Greetings,
Henrie
The gbook.php file is not meant to be edited by someone who does not how it works.
Place your own code in the header.txt and footer.txt files included in the gbook zip file. This way code can be placed at the beginning of the <body> tag before start of the guestbook code (header.txt) and just before the </body> tag after the end of the guestbook code (footer.txt) file.
Because you have added your own code, now two <head>...</head><body> parts exist in the code presented to the browser where this part should exist only ones. View the source code from your browser to check your page (not only in the program you code with).
If you want to add your own headers and footers, you have to replace the code in the gbook.php file with you own code (not add it).
In the gbook.php version 1.34 the headers start at line 619 (function printTopHTML() {)
The footer starts at line 641 (function printDownHTML() {)
In the gbook.php version 1.34 HL.03 the headers start at line 777 (function printTopHTML() {)
The footer starts at line 825 (function printDownHTML() {)
Greetings,
Henrie
Thanks Henrie, it's starting to make sense.
I now have it working fine, I just need to style elements I havent accounted for in my css, should be simple.
One more thing, can I simply remove the validation div in the gbook file? - I dont need the W3C button as I have one in my left column.
EDIT - I also need to delete the links for the alternative stylesheets.
Thanks!
Dave
I now have it working fine, I just need to style elements I havent accounted for in my css, should be simple.
One more thing, can I simply remove the validation div in the gbook file? - I dont need the W3C button as I have one in my left column.
EDIT - I also need to delete the links for the alternative stylesheets.
Thanks!
Dave
Hi again,
Right, my gbook is starting to take shape. I have my code in the header.txt and the footer.txt
But, as you say the headers are also being written from the gbook.php file.
You say I should replace the header writing code on line 777 in the gbook.php file with my code, but won't the code still result in having the header added twice?
I am at this stage: http://www.davereederdesign.com/gbook/gbook.php#
Right, my gbook is starting to take shape. I have my code in the header.txt and the footer.txt
But, as you say the headers are also being written from the gbook.php file.
You say I should replace the header writing code on line 777 in the gbook.php file with my code, but won't the code still result in having the header added twice?
I am at this stage: http://www.davereederdesign.com/gbook/gbook.php#
Hello Dave,
It's no problem to remove the xhtml logo. Just remove the code from lines 838 and 839
To remove the alternate skin chooser in settings.php set $settings['show_skinner']=0;
Alternatively you can also remove the code from the gbook.php file.
Remove lines 791-195
and lines 806-812
and in line 788change nostyle.css to the name of your style sheet.
Your own headers <head>...</head> section should not be placed in the header.txt file. This should be edited in the gbook.php file.
Only the code you normally put in your <body> section (like menu) should be placed in the header.txt file.
Greetings,
Henrie
It's no problem to remove the xhtml logo. Just remove the code from lines 838 and 839
Code: Select all
echo '
<div class="xhtml"><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" title="Valid XHTML 1.1" alt="Valid XHTML 1.1" height="31" width="88" /></a></div>';
Alternatively you can also remove the code from the gbook.php file.
Remove lines 791-195
Code: Select all
if($settings['skin1css'] == "") {echo '<link rel="stylesheet" type="text/css" href="style.css" />';} else {echo '<link rel="stylesheet" type="text/css" href="'.$settings[skin1css].'" title="skin1" />';}
if($settings['show_skinner'] == 1 && $settings['skin2css'] != "") {echo '<link rel="alternate stylesheet" type="text/css" href="'.$settings[skin2css].'" title="skin2" />';}
if($settings['show_skinner'] == 1 && $settings['skin3css'] != "") {echo '<link rel="alternate stylesheet" type="text/css" href="'.$settings[skin3css].'" title="skin3" />';}
if($settings['show_skinner'] == 1 && $settings['skin4css'] != "") {echo '<link rel="alternate stylesheet" type="text/css" href="'.$settings[skin4css].'" title="skin4" />';}
if($settings['show_skinner'] == 1 && $settings['skin5css'] != "") {echo '<link rel="alternate stylesheet" type="text/css" href="'.$settings[skin5css].'" title="skin5" />';}
Code: Select all
if($settings['show_skinner'] == 1) {echo '<div id="gbookstyle"><p>'.$lang[skin].'</p><ul>';}
if($settings['show_skinner'] == 1 && $settings['skin1css'] != "") {echo '<li><a href="#" onclick="setActiveStyleSheet(\'skin1\'); return false;">'.$settings[skin1name].'</a></li>';}
if($settings['show_skinner'] == 1 && $settings['skin2css'] != "") {echo '<li>'.$settings[skin_sep].'<a href="#" onclick="setActiveStyleSheet(\'skin2\'); return false;">'.$settings[skin2name].'</a></li>';}
if($settings['show_skinner'] == 1 && $settings['skin3css'] != "") {echo '<li>'.$settings[skin_sep].'<a href="#" onclick="setActiveStyleSheet(\'skin3\'); return false;">'.$settings[skin3name].'</a></li>';}
if($settings['show_skinner'] == 1 && $settings['skin4css'] != "") {echo '<li>'.$settings[skin_sep].'<a href="#" onclick="setActiveStyleSheet(\'skin4\'); return false;">'.$settings[skin4name].'</a></li>';}
if($settings['show_skinner'] == 1 && $settings['skin5css'] != "") {echo '<li>'.$settings[skin_sep].'<a href="#" onclick="setActiveStyleSheet(\'skin5\'); return false;">'.$settings[skin5name].'</a></li>';}
if($settings['show_skinner'] == 1) {echo '</ul></div>';}
Code: Select all
<link rel="stylesheet" type="text/css" href="nostyle.css" />
Your own headers <head>...</head> section should not be placed in the header.txt file. This should be edited in the gbook.php file.
Only the code you normally put in your <body> section (like menu) should be placed in the header.txt file.
Greetings,
Henrie
Forgive me for inviting myself but I want to make sure I'm understanding this properly (I'm using gbook135 and adding it to my oscommerce site)-
are you guys saying that I need to replace this code:
with this from my oscommerce build:
My gbook is currently here and works great as a standalone but I'd really like to get it nested into my site:
http://oddsandinsonline.com/catalog/gbook.php
are you guys saying that I need to replace this code:
Code: Select all
function printTopHTML() {
global $settings;
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>'.$settings['gbook_title'].'</title>
<meta content="text/html; charset=windows-1250">
<link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
';
include_once 'gheader.txt';
echo '<h3 align="center">'.$settings['gbook_title'].'</h3>
<p align="center"><a href="'.$settings['website_url'].'">Back to '.$settings['website_title'].'</a>
| <a href="gbook.php">View guestbook</a>
| <a href="gbook.php?a=sign">Sign guestbook</a></p>
<div align="center">
<center>
';
} // END printTopHTML
Code: Select all
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
http://oddsandinsonline.com/catalog/gbook.php
Hello Quin,
Why don't you just try and find out.
Be sure to make a backup of the gbook.php file before you change it so you can always revert back when it does not work.
If the included header.php file includes all the information you delete out of the gbook.php file (header information including link to the gbook style.css file) I think it should work.
Greetings,
Henrie
Why don't you just try and find out.
Be sure to make a backup of the gbook.php file before you change it so you can always revert back when it does not work.
If the included header.php file includes all the information you delete out of the gbook.php file (header information including link to the gbook style.css file) I think it should work.
Greetings,
Henrie
A tip so that the styles from the gbook don't interfere with your own (if you want for example the Anchor (links) styles to be different.
Enclose the whole entries part of the gbook in a div with an id (for example <div id=gbook>).
You can do this by putting the start of this div at the end of you changed head section and end the div at the start of your changed foot section.
Then in the style sheet change all the styles to include the div reference.
For example change: BODY, TD {...} to #gbook, #gbook TD {...}
and for example TD.upper {...} to #gbook TD.upper {...}
and for example A {...} and A:HOVER {...} to #gbook A {...} and #gbook A:HOVER {...}
This way you can include the styles in your own stylesheet and they will not interfere with the rest of your styles because they will all be unique.
Greetings,
Henrie
Enclose the whole entries part of the gbook in a div with an id (for example <div id=gbook>).
You can do this by putting the start of this div at the end of you changed head section and end the div at the start of your changed foot section.
Then in the style sheet change all the styles to include the div reference.
For example change: BODY, TD {...} to #gbook, #gbook TD {...}
and for example TD.upper {...} to #gbook TD.upper {...}
and for example A {...} and A:HOVER {...} to #gbook A {...} and #gbook A:HOVER {...}
This way you can include the styles in your own stylesheet and they will not interfere with the rest of your styles because they will all be unique.
Greetings,
Henrie
I think I've got it- what I ended up doing (in case someone comes along searching the forum for this some day) was to copy/paste the top of a standard osc page (such as conditions.php) and then where the header was called for in header.txt I replaced it with the header
(so my print top and print bottom functions now look like this:
I also renamed header.txt and footer.txt with a g at the beginning to keep confusion at a minimum in my files)
and again did the same thing with the call for column right/column left. On the style features I simply added a snippet of it directly to the header.txt like so:
I repeated this with the footer.txt- copy/paste the bottom of a standard page and then replaced the call for column right and the standard footer with the actual code from those 2 files- additionally, I found it necessary to remove the shopping cart include on column right and the specials and what's new calls on column left- it just kept bringing the price back as zero. Finally, instead of using the php echo call for the continue button at bottom I hard-coded the image and link.
I'm still having a problem with some code in application top, it keeps logging me out whenever I visit the page, but I suspect it will work as well to simply replace the call with the copy/paste solution as well.
Again- many, many thanks to you Henrie- you were very helpful!
(so my print top and print bottom functions now look like this:
Code: Select all
function printTopHTML() {
global $settings;
include_once 'gheader.txt';
} // END printTopHTML
function printDownHTML() {
global $settings;
include_once 'gfooter.txt';
} // END printDownHTML
and again did the same thing with the call for column right/column left. On the style features I simply added a snippet of it directly to the header.txt like so:
Code: Select all
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<STYLE type="text/css">
TD.upper {
color : #FFFFFF;
background : #BBD3C2;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
}
FONT.smaller {
font-size: 10px;
}
table.entries {
color : black;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
BORDER-RIGHT: #BBD3C2 1px solid;
BORDER-LEFT: #BBD3C2 1px solid;
BORDER-TOP: #BBD3C2 1px solid;
BORDER-BOTTOM: #BBD3C2 1px solid;
}
}</STYLE>
</head>
I'm still having a problem with some code in application top, it keeps logging me out whenever I visit the page, but I suspect it will work as well to simply replace the call with the copy/paste solution as well.
Again- many, many thanks to you Henrie- you were very helpful!