Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Jeffrey (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 01-29-2001 Last Update: Never Installs: 0
 
No support by the author.

On my main page ( www.caviesgalore.com ) I get:

Warning: Cannot add header information - headers already sent by (output started at /home2/cavy4me/public_html/index.php:7) in /home2/cavy4me/public_html/forums/global.php on line 1495

Warning: Cannot add header information - headers already sent by (output started at /home2/cavy4me/public_html/index.php:7) in /home2/cavy4me/public_html/forums/global.php on line 1501

When I try to display the last 4 posts. The code I'm using is, what can I do?:
Code:
<?
chdir("/home/cavy4me/public_html/forums/");
include("global.php");

$num_active = 4; 
$num_chars = 40;

$db=mysql_connect($servername,$dbusername,$dbpassword); 

mysql_select_db($dbname); 


$querylatest="SELECT * FROM thread WHERE forumid='1' OR forumid='2' OR forumid='3' OR forumid='4' OR forumid='5' OR forumid='6' OR forumid='10' ORDER BY lastpost DESC LIMIT $num_active"; 

$resultlatest = mysql_query($querylatest,$db); 

while ($latest_array = mysql_fetch_array($resultlatest)) { 

// Get Forum Infomation 
$query_forum = "select * from forum where forumid='$latest_array[forumid]'"; 
$result_forum = mysql_query($query_forum,$db); 
$forum_info_array = mysql_fetch_array($result_forum); 

// split the date up a bit 
$datestr1 = substr($latest_array["dateline"],0,10); 
$datetime = substr($latest_array["dateline"],11,8); 

$querythread="SELECT * FROM post WHERE threadid='$latest_array[threadid]' ORDER BY dateline ASC LIMIT 1"; 

$result_thread_text= mysql_query($querythread,$db); 

$result_thread_array = mysql_fetch_array($result_thread_text); 

$newstitle = $latest_array["title"]; 
$newsposter = $latest_array["postusername"]; 
$newsposterid = $result_thread_array["userid"]; 
$newsdate = date("D j M Y", $latest_array["dateline"]); 
$newstext = substr(strip_tags($result_thread_array["pagetext"]),0,$num_chars);
$newsthreadid = $latest_array["threadid"]; 
$newscomments = $latest_array["replycount"]; 
$threadforumid = $latest_array["forumid"];
$threadforum = $forum_info_array["title"];
$threadiconid = $latest_array["iconid"];

// split apart long URL strings
$newstext=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=_blank>\\1</a>",$newstext); 
$newstext=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>(hyperlink)</a>",$text); 

$newstext=eregi_replace("\\[url=\"([^\"]*)\"\\]([^\\[]*)\\[\\/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$newstext); 
$newstext=eregi_replace("\\[url=([^\"]*)\\]([^\\[]*)\\[\\/url\\]","<a href=\"\\1\" target=_blank>(hyperlink)</a>",$newstext); 
//special thank-you to Menno at vBulletin Community Forum for coming up with the above part!

if ($threadiconid==0) {
 $threadicon = "";
 }
else {
 $threadicon = "<img src=\"/bbs/images/icons/icon$threadiconid.gif\" alt=\"Thread icon\">&nbsp;";
 }

if ($newscomments==1) {
 $commenttext = "reply";
 }
else {
 $commenttext = "replies";
 }

print("
<table width=\"90%%\" cellpadding=\"2\" BORDER=0 ALIGN=CENTER>
<tr><td width=\"100%%\" bgcolor=\"#99CCFF\" class=\"sidebar1\">
<FONT SIZE=-1><B>Subject: $newstitle</B></FONT><br>
</td></tr><tr>
<td width=\"100%%\" class=\"sidebar1\" bgcolor=\"#f7f7f7\">
<FONT SIZE=-1>Read the <a href=\"http://www.caviesgalore.com/forums/showthread.php?threadid=$newsthreadid\" class=\"sidebar1\">$newscomments $commenttext</a><br></FONT>
</td></tr></table>
"); 
} 

?>

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-29-2001, 03:43 PM
Guest
 
Posts: n/a
Default

The most common cause for the error message you have there is the code trying to send an HTTP header after output has already been sent to the browser.

For example:
Code:
<?
echo $moo;
setcookie("moocookie", $moo);
?>
will not work, because PHP is trying to send an HTTP header (setcookie) after output has been sent to the browser.

This will work:
Code:
<?
setcookie("moocookie",$moo);
echo $moo;
?>
To debug your problem, go through the code looking for any echo, print, printf (or similar) statements that occur before setcookie(..) or header(..) statements...
Reply With Quote
  #3  
Old 02-15-2001, 12:15 AM
Guest
 
Posts: n/a
Default

I've shrunken the code to this: but I still get the errors. Can Anyone help?

Quote:
<?
chdir("/home/cavy4me/public_html/forums/");
include("global.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$num_active = 4;
$num_chars = 40;

$query_forum = "select * from forum where forumid='$latest_array[forumid]'";
$result_forum = mysql_query($query_forum,$db);
$forum_info_array = mysql_fetch_array($result_forum);
$querythread="SELECT * FROM post WHERE threadid='$latest_array[threadid]' ORDER BY dateline ASC LIMIT 1";
$result_thread_text= mysql_query($querythread,$db);
$result_thread_array = mysql_fetch_array($result_thread_text);

$querylatest="SELECT * FROM thread WHERE forumid='1' OR forumid='2' OR forumid='3' OR forumid='4' OR forumid='5' OR forumid='6' OR forumid='10' ORDER BY lastpost DESC LIMIT $num_active";

$resultlatest = mysql_query($querylatest,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
if ($newscomments==1) {
$commenttext = "reply";
}
else {
$commenttext = "replies";
}
$newstitle = $latest_array["title"];
$newscomments = $latest_array["replycount"];
$newsthreadid = $latest_array["threadid"];
print("<table width=90%% cellpadding=2 BORDER=0 ALIGN=CENTER><tr><td width=100%% bgcolor=#99CCFF><FONT SIZE=-1><B>Subject: $newstitle</B></FONT><br></td></tr><tr><td width=100%% bgcolor=#f7f7f7><FONT SIZE=-1>Read the <a href=http://www.caviesgalore.com/forums/showthread.php?threadid=$newsthreadid>$newscomment s $commenttext</a><br></FONT></td></tr></table>");
}
?>
Reply With Quote
  #4  
Old 02-15-2001, 02:13 AM
Guest
 
Posts: n/a
Default

Delete all the white space before and after your enclosing PHP tags... <? ?>
Reply With Quote
  #5  
Old 02-16-2001, 01:03 AM
Guest
 
Posts: n/a
Default

By whitespace, do you mean double line breaks? Because I did that and it doesn't change anything.
Reply With Quote
  #6  
Old 02-16-2001, 01:09 AM
Guest
 
Posts: n/a
Default

Yes.. All the white space (line breaks, tabs and spaces) in the global.php file has to be eliminated.

Only look at stuff outsie the <? ?> tags.. Don't concern yourself with what is inside.

This isn't a Netscape error.
Reply With Quote
  #7  
Old 02-21-2001, 11:51 AM
Guest
 
Posts: n/a
Default

Yes!!! Thank you so much!! I was having the same problem and removing the white spaces fixed it! Happy dancing here! Can't believe it was that simple!
Tigerlily
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08047 seconds
  • Memory Usage 2,251KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete