Page 1 of 1

Warning: Cannot modify header information

Posted: Mon Jul 10, 2006 9:33 am
by StarF
Hi

After a update i am getting these errors:

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/eskape/eskape.dk/default3.php:14) in /hsphere/local/home/eskape/eskape.dk/index2.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/eskape/eskape.dk/default3.php:14) in /hsphere/local/home/eskape/eskape.dk/index2.php on line 20
all over the place.

i have a index.php wich contains:

Code: Select all

<?php 
$_REQUEST['page'] = 'blog'; 

ob_start(); 
chdir('blog'); 
require 'index2.php'; 
$blog_data = ob_get_contents(); 
chdir('..'); 
ob_end_clean(); 

require 'default3.php'; 
?>
index2.php is the blog index

default3.php is the design with this code to load the pages:

Code: Select all

	<?php


$page = $_GET['page']; 
if (($page == "velkommen") or ($page =="")) { 
include('index2.php'); 
} else if($page == "ruslandhistorie") { 
include('side_ruslandhistorie.php'); 
} else if($page == "b_behavior") { 
include('side_business_bahavior.php'); 
} else if($page == "sdu") { 
include('side_sdu.php');
} else if($page == "arkiv") { 
include('side_arkiv.php');
} else if($page == "links") { 
include('side_links.php'); 
} else if($page == "ommig") { 
include('side_ommig.php');
} else if($page == "cv") { 
include('side_cv.php'); 
} else if($page == "omside") { 
include('side_omside.php'); 
} else if($page == "end") { 
include('end.html');
}
?>
can any tell me why i am getting these errors? and what i can do to remove em?

Re: Warning: Cannot modify header information

Posted: Mon Jul 10, 2006 12:30 pm
by garvinhicking
Hi!

This error message tells you that some script (default3.php at line 14) is returning HTML code output (or blank lines), but a header() call in index2.php on line 19 is done. No HTML output may happen before a header() PHP call, so you need to restructure your PHP files in a way that s9y's index.php is called before any other output is emitted. You can work with different ob_* levels to cache output before it is emitted.

What is that index2.php file? And where is serendipity's index.php? You don't need to rename Serendipity Files if you have the indexFile option and your .htaccess file configured as in the embed-documentation, and your embed script is working properly. :)

Best regards,
Garvin

Posted: Mon Jul 10, 2006 12:48 pm
by StarF
tnx for the explenation, the index2.php file is the default blog file.

I will try to make my index.php (wich is wrapper) and call it wrapper.php and then set wrapper as the index file, and then rename index2.php to index.php and see how that works.

Posted: Mon Jul 10, 2006 1:00 pm
by StarF
Alright tryed that, so now i got the folliwing setup

index.php wich is the blog index file.

wrapper.php

contains this code:

Code: Select all

<?php 
$_REQUEST['page'] = 'blog'; 

ob_start(); 
chdir('blog'); 
require 'index.php'; 
$blog_data = ob_get_contents(); 
chdir('..'); 
ob_end_clean(); 

require 'default3.php'; 
?>
default3, wich is the design the blog should be embeded into:

also contains this php code to load the diffrent pages:

Code: Select all

<?php
$page = $_GET['page']; 
if (($page == "velkommen") or ($page =="")) { 
include('index.php'); 
} else if($page == "ruslandhistorie") { 
include('side_ruslandhistorie.php'); 
} else if($page == "b_behavior") { 
include('side_business_bahavior.php'); 
} else if($page == "sdu") { 
include('side_sdu.php');
} else if($page == "arkiv") { 
include('side_arkiv.php');
} else if($page == "links") { 
include('side_links.php'); 
} else if($page == "ommig") { 
include('side_ommig.php');
} else if($page == "cv") { 
include('side_cv.php'); 
} else if($page == "omside") { 
include('side_omside.php'); 
} else if($page == "end") { 
include('end.html');
}
?>


The blog is set to use the wrapper.php as the index file, i am stil getting these errors:

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/eskape/eskape.dk/default3.php:14) in /hsphere/local/home/eskape/eskape.dk/index.php on line 20

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/eskape/eskape.dk/default3.php:14) in /hsphere/local/home/eskape/eskape.dk/index.php on line 21
how should i embed the blog to get rid of these errors?

Posted: Mon Jul 10, 2006 1:45 pm
by garvinhicking
Hi!

Did you paste the full content of the files? Because the error messages says, that default3.php is called before your index.php is called.

What is in your index.php at line 20 and 21? Or is that mentioned index.php file the serendipity file? In that case, it seems that default3.php is called BEFORE your wrapper, how can that be?

Best regards,
Garvin

Posted: Mon Jul 10, 2006 1:49 pm
by StarF
the entire default3.php is:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="generator" content="Adobe GoLive">
		<title>Eskape.dk - Nøglen til Rusland</title>
		<link href="style.css" rel="stylesheet" type="text/css" media="all">
	</head>

	<body>
		<div align="center">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="top_v"></td>
					<td class="top_banner"><object type="application/x-shockwave-flash" data="top.swf" width="950" height="144">
<param name="movie" value="top.swf">
</object></td>
					<td class="top_h"></td>
				</tr>
			</table>
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="top_v2"></td>
					<td class="top_bar"><?php
require('menu.php');
?>		</td>
					<td class="top_h2"></td>
				</tr>
			</table>
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="side_menu">
<?php
require('side.php');
?>					
<div class="menu_txt"><script type="text/javascript"><!--

google_ad_client = "pub-0273733612636187";

google_alternate_ad_url = "http://www.eksape.dk";

google_ad_width = 120;

google_ad_height = 240;

google_ad_format = "120x240_as";

google_ad_type = "text_image";

google_ad_channel ="";

google_color_border = "DDAAAA";

google_color_bg = "ECF8FF";

google_color_link = "0033FF";

google_color_url = "0033FF";

google_color_text = "000000";

//--></script>

<script type="text/javascript"

  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script></div>

</td>
					<td class="indexH">
					
					<?php


$page = $_GET['page']; 
if (($page == "velkommen") or ($page =="")) { 
include('index.php'); 
} else if($page == "ruslandhistorie") { 
include('side_ruslandhistorie.php'); 
} else if($page == "b_behavior") { 
include('side_business_bahavior.php'); 
} else if($page == "sdu") { 
include('side_sdu.php');
} else if($page == "arkiv") { 
include('side_arkiv.php');
} else if($page == "links") { 
include('side_links.php'); 
} else if($page == "ommig") { 
include('side_ommig.php');
} else if($page == "cv") { 
include('side_cv.php'); 
} else if($page == "omside") { 
include('side_omside.php'); 
} else if($page == "end") { 
include('end.html');
}
?>
					
					</td>
				</tr>
			</table>
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="bottom"></td>
				</tr>
			</table>
			<center>The site was done by <a href="http://www.evilsun.dk">EvilSun.DK</a>
		</div>
	</body>

</html>
the way i did this worked fine with the older blog versions, it just after i updated i got these problems....

Posted: Mon Jul 10, 2006 3:00 pm
by garvinhicking
Hi!

Hm, it seems to me that your default3.php is including index.php a second time if the page is empty. You must alway include the s9y scripts before you output anything else!

To keep it simple, just put a "ob_start()" at the top of your default3.php script, this should do the trick.

Regards,
Garvin

Posted: Tue Jul 11, 2006 9:49 am
by StarF
perfect once again tnx for all you help :)