Connecting Tech Pros Worldwide Help | Site Map

Inclusion confusion (Javascript in function?)

  #1  
Old May 12th, 2006, 02:25 AM
Steve Brecher
Guest
 
Posts: n/a
Context: I am having a problem with the phpBB package. Currently about
0.4 on the 0-10.0 scale from utter cluelessness to wizardry with respect to
PHP, I find a small debugging package at
http://www.zend.com/zend/tut/tutorial-DebugLib.php
and take the script presented there and name its file debugging.php. It
includes several function definitions, but no other code. So that you don't
have to follow the link, my guess is that the relevant definition is:
function debug_open_window()
{
static $window_opened = FALSE;
if(!$window_opened)
{
?>
<script language="JavaScript">
debugWindow =
window.open("","debugWin","toolbar=no,scrollbars,w idth=600,height=400");
debugWindow.document.writeln('<html>');
debugWindow.document.writeln('<head>');
debugWindow.document.writeln('<title>PHP Remote Debug
Window</title>');
debugWindow.document.writeln('</head>');
debugWindow.document.writeln('<body><font face="verdana,arial">');
debugWindow.document.writeln('<hr size=1 width="100%">');
</script>
<?
$window_opened = TRUE;
}
}

I insert as the first statement of the phpBB's index.php:
include('debugging.php');

and load index.php. The aim is to see whether the debugging code will parse
error-free. I get the following output prior to the expected first page of
our Forum:

Warning: Cannot modify header information - headers already sent by (output
started at [path]/forum/debugging.php:1) in
[path]/forum/includes/page_header.php on line 483

and two more of the same warnings for lines 485 and 486. Each of these
statements is a call to header().

Am I the only one confused, or is the PHP 4.4.2 that my shared linux/Apache
host is running also confused? I am confused because I don't see how simply
defining functions could generate the warnings.

--
For mail, please use my surname where indicated:
steve@surname.reno.nv.us (Steve Brecher)


  #2  
Old May 12th, 2006, 04:55 AM
Steve Brecher
Guest
 
Posts: n/a

re: Inclusion confusion (Javascript in function?)


I wrote:[color=blue]
> I find a small debugging package at
> http://www.zend.com/zend/tut/tutorial-DebugLib.php
> and take the script presented there and name its file debugging.php. It
> includes several function definitions, but no other code.[/color]

But it does include a space character at the start of the file immediately
before "<?php" and that is what generated the warnings.

--
For mail, please use my surname where indicated:
steve@surname.reno.nv.us (Steve Brecher)


  #3  
Old May 12th, 2006, 06:05 AM
Chung Leong
Guest
 
Posts: n/a

re: Inclusion confusion (Javascript in function?)


Steve Brecher wrote:[color=blue]
> Context: I am having a problem with the phpBB package. Currently about
> 0.4 on the 0-10.0 scale from utter cluelessness to wizardry with respect to
> PHP, I find a small debugging package at
> http://www.zend.com/zend/tut/tutorial-DebugLib.php
> and take the script presented there and name its file debugging.php.[/color]

Good luck. Beware that debugging phpBB might make you go blind 8-)

  #4  
Old May 14th, 2006, 01:55 AM
Alan Little
Guest
 
Posts: n/a

re: Inclusion confusion (Javascript in function?)


Carved in mystic runes upon the very living rock, the last words of
Steve Brecher of comp.lang.php make plain:
[color=blue]
> I wrote:[color=green]
>> I find a small debugging package at
>> http://www.zend.com/zend/tut/tutorial-DebugLib.php
>> and take the script presented there and name its file debugging.php.
>> It includes several function definitions, but no other code.[/color]
>
> But it does include a space character at the start of the file
> immediately before "<?php" and that is what generated the warnings.[/color]

Always the first thing to suspect, with that sort of problem. The second
thing to suspect is white space after the ?>, and the third thing to
suspect is invisible characters (e.g. control characters) which can creep
in upon occasion.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How a delete a object from DOM ? Cylix answers 22 August 12th, 2006 11:55 PM
FAQ update (roundup of pending requests - for comment) Richard Cornford answers 42 July 20th, 2005 02:38 PM
Putting "javascript:" in front of code? delerious@no.spam.com answers 25 July 20th, 2005 01:38 PM
Works in ie and opera not mozilla tony kulik answers 10 July 20th, 2005 12:26 PM