PDA

View Full Version : Cannot add header information?


voogru
02-08-2002, 12:30 PM
im having a problem trying to include global.php in my main page (non-vB)

heres what the top of header.php looks like for my main site:


<?
/*
Includes
*/
chdir("/home/voogru/public_html/forums");
require('global.php');
chdir("/home/voogru/public_html/");
?>
<title>voogru.com You IT Resource</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL="StyleSheet" HREF="/style/style.css" TYPE="text/css">
<style>
.last10{ border: 1px #616889 solid; background-color: #ffffff; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000; text-decoration: none}
.pluhnews{ border: 1px #000000 solid; background-color: #F1F5F8; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000; text-decoration: none}



the two errors i get are:

Warning: Cannot add header information - headers already sent by (output started at /home/voogru/public_html/index.php:3) in /home/voogru/public_html/forums/admin/functions.php on line 1610

Warning: Cannot add header information - headers already sent by (output started at /home/voogru/public_html/index.php:3) in /home/voogru/public_html/forums/admin/functions.php on line 1610


i tried everything i can think of, im very new to php so i need help!

thanks :)

Admin
02-08-2002, 05:49 PM
In the
/*
Includes
*/
part, do you have anything that echo/print/outputs stuff to the browser?

voogru
02-08-2002, 06:00 PM
not that i know of, no

i belive /* and */ are for commenting out text, right?

thats just so when i put more code i cant find different areas easier.

TECK
02-09-2002, 03:16 PM
hmmm.. you probably want to have 2 diff headers. this is not the best way to do it (in my oppinion). try this:

01. open root/global.php.

02. find the code:$templatesused.='gobutton,timezone,[...]'and add at the end:,home_headinclude,home_header,home_footer03. find the code:$header='';
$footer='';

// parse PHP include ##################
eval(gettemplate('phpinclude',0,0));

// parse css, header & footer ##################
eval("\$headinclude = \"".gettemplate('headinclude')."\";");
eval("\$header .= \"".gettemplate('header')."\";");
eval("\$footer .= \"".gettemplate('footer')."\";");
replace it with:$header='';
$headerhome='';
$footer='';
$footerhome='';

// parse PHP include ##################
eval(gettemplate('phpinclude',0,0));

// parse css, header & footer ##################
eval("\$headinclude = \"".gettemplate('headinclude')."\";");
eval("\$headincludehome = \"".gettemplate('home_headinclude')."\";");
eval("\$header .= \"".gettemplate('header')."\";");
eval("\$headerhome .= \"".gettemplate('home_header')."\";");
eval("\$footer .= \"".gettemplate('footer')."\";");
eval("\$footerhome .= \"".gettemplate('home_footer')."\";");03. create the 3 templates with the content you want.

that should solve your prob ;).

voogru
02-10-2002, 12:01 PM
i did that but i still get "Warning: Cannot add header information - headers already sent by (output started at /home/voogru/public_html/index.php:3) in /home/voogru/public_html/forums/admin/functions.php on line 1612" my problem is i cant figure out how to get global.php to work on a non-vb page. if someone can tell me how to include it it would be great, right now im trying to use:

<?
/*
Includes
*/
chdir("/home/voogru/public_html/forums");
require('global.php');
chdir("/home/voogru/public_html/");
?>

and i dont know if this is the right way. if someone could point me in the right direction to include global.php it would be great.

thanks

TECK
02-10-2002, 01:25 PM
what i would me is this:

01. create a insertcode.php file with all the code i need to add in specific files and place it in root/forum.

02. call insertcode.php in each file i want to add the specific code. in this way you will never have any problems.

Martz
02-10-2002, 01:32 PM
From my very limited experience, I have got these "Cannot add header information" when I have used cpheader() and another <head></head> tag in the same file. Requiring the global.php will (I am guessing) format your page with the standard headers, if your including a another file or complete .html file this might conflict?

Might be worth a try :frus: