The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Details »» | |||||||||||||||||||||||||
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\"> "; } 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
|
Comments |
#2
|
|||
|
|||
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); ?> This will work: Code:
<? setcookie("moocookie",$moo); echo $moo; ?> |
#3
|
|||
|
|||
I've shrunken the code to this: but I still get the errors. Can Anyone help?
Quote:
|
#4
|
|||
|
|||
Delete all the white space before and after your enclosing PHP tags... <? ?>
|
#5
|
|||
|
|||
By whitespace, do you mean double line breaks? Because I did that and it doesn't change anything.
|
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
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 |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|