phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Header problem with fetch all mod


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
circpros
Board Member



Joined: 23 Dec 2009

Posts: 1



PostPosted: Wed Dec 23, 2009 5:41 am 
Post subject: Header problem with fetch all mod

Howdy....

I am new to the forum... any assistance is greatly appreciated.

I'm running into an issue with a heavily modded phpbb 2.0.21 forum, specifically with a fetch_all mod that syndicates content. My problem isn't specific to phpbb..... I'm a programmer and have a working understanding of php, but I can't quite iron out this problem that cropped up when I tried to rework the code...

Here are the error messages:
Quote:

Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/index.php:7) in /home/site/public_html/listings/includes/sessions.php on line 254

Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/index.php:7) in /home/site/public_html/listings/includes/sessions.php on line 255


Here is the code block that is producing the error:

Code:
<?
// This path points to the directory where phpBB is installed. Do
// not enter an URL here. The path must end with a trailing
// slash.
//
// Examples:
// forum in /aaa/bbb/ccc/ and script in /aaa/bbb/ccc/
// --> $phpbb_root_path = './';
// forum in /aaa/bbb/ccc/ and script in /aaa/bbb/
// --> $phpbb_root_path = './ccc/';
// forum in /aaa/bbb/ccc/ and script in /aaa/bbb/ddd/
// --> $phpbb_root_path = '../ccc/';
//

$phpbb_root_path = './listings/';

//
// prevent hacking attempts - phpBB needs this line to work
//

define ('IN_PHPBB', true);

//
// lets make a little check if your root_path is correct ;-)
//

if (!file_exists($phpbb_root_path . 'extension.inc'))
{
   die ('<tt><b>phpBB Fetch All:</b>
      $phpbb_root_path is wrong and does not point to your forum.</tt>');
}

//
// now we include (integrate) some files which we need
//

//
// this is a phpBB file
//

include_once ($phpbb_root_path . 'extension.inc');

//
// again a phpBB file
//

include_once ($phpbb_root_path . 'common.' . $phpEx);

//
// phpBB file, too
//

include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx);

//
// well, this is 'our' file - the common Fetch All file needed
// every time you use Fetch All
//

include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);

//
// since we are 'only' displaying some news we only need this one
//

include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx);

//
// these lines will setup the phpBB session management which we need
// for proper security settings - just don't touch them unless you know
// what you are doing
//

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

//
// here we go: fetch some news!
//

$news = phpbb_fetch_posts();

//
// disconnect from the database
//

phpbb_disconnect();

//
// Hint:
//
// If you are curious what's in the $news array
// --> uncomment the following line
// You will see all elements of the array along with
// their keys and values.
//

// echo ('<pre>'); print_r($news); die();

?>

<p>
<?php

//
// output all postings - this is the common method of displaying
// fetched data --> it is called a for() loop
//
// the for loop will go through every element of our result; thus
// it displays all entries
//
// an element will be displayed by
//
//     echo $news[$i]['topic_title'];
//
// which displays the topic title of the current posting of the loop
//

for ($i = 0; $i < count($news); $i++) {

?>
Posted:
<?php echo $news[$i]['date']; ?>
<h2>
<?php echo $news[$i]['topic_title']; ?>
</h2>
<br>
<?php echo $news[$i]['post_text']; ?>
<hr size="1"/>
<p />
<?php

}

?>


I've fixed this issue on my own before, but I was rewriting the main page and deleted the code I was using and had to head back to the original fetch_all code.... it's been a few years since I dealt with it last, and I'll be darned if I can figure out what I did to fix it....

Any assistance would be greatly appreciated!
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Wed Dec 23, 2009 8:53 am 
Post subject: Re: Header problem with fetch all mod

This could be caused by something as simple as whitespace before the first <? and it's also possble that you can solve this by adding php after the opening <?, making it look like <?php

See if that helps.

_________________
phpBB2 will never die, I hope!
Back to top
Merri
Board Member



Joined: 02 Feb 2009

Posts: 63
Location: Kanta-Häme


flag
PostPosted: Fri Dec 25, 2009 1:28 am 
Post subject: Re: Header problem with fetch all mod

phpBB uses templating. Thus any unwanted output before the template code kicks in causes these problems. This problem specifically is caused by this:
Code:
?>

<p>
<?php


That is non-templated HTML output, sends headers apparently before phpBB handles it's own and thus throws an error at you.

_________________
Comboa Twitter
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0123 seconds using 15 queries. (SQL 0.0019 Parse 0.0005 Other 0.0099)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo