Re: [PHP] Re: header headers_sent BUG
read www.php.net/variables.scope Eric Fleming wrote: I am having some problems using variables in included files. Can someone please look at my code below and see how I might accomplish what I am trying to do? ?php $subnav = home; include(incHeader.php); ? !--- CONTENT AREA --- The content would go here. !--- END CONTENT AREA --- ?php include (incFooter.php); ? Now, when I try to reference the subnav variable in the inHeader.php or incFooter.php files, it comes up blank. I am basically trying to adjust the navigation on each page depending on the page I am on. I am just learning PHP, have programmed in ColdFusion for years and in ColdFusion this was not a problem. Any ideas? Eric Fleming -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: header headers_sent BUG
I am having some problems using variables in included files. Can someone please look at my code below and see how I might accomplish what I am trying to do? ?php $subnav = home; include(incHeader.php); ? !--- CONTENT AREA --- The content would go here. !--- END CONTENT AREA --- ?php include (incFooter.php); ? Now, when I try to reference the subnav variable in the inHeader.php or incFooter.php files, it comes up blank. I am basically trying to adjust the navigation on each page depending on the page I am on. I am just learning PHP, have programmed in ColdFusion for years and in ColdFusion this was not a problem. Any ideas? Eric Fleming -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: header headers_sent BUG
You might want to check whether or not your header output is getting buffered. My suggestion is a flush() after the fist call. I'm not an expert on this, it's just an idea. HTH -- Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands James M. Luedke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all: I am having a hard time with a small piece of code. I was wondering if someone may be able to explain why the following code will not work... I have been scratching my head for a few hours now and I am stumped. ?php header(Location: http://someplace.com;); if( ! headers_sent()) header(Location: http://somplaceelse.com;); ? So I would expect this piece of code to direct me to somplace.com. However it does not, and I always end up at somplaceelse.com. I have done a tcpdump to assist with debugging here is the output below. From the look of it the first header is getting ignored all toghether. Is there some way to force changes I made to the headers, that will make headers_sent return TRUE? Thanks, -James --- GET /tracking/test.php HTTP/1.1 Host: dev.www.someplace.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q= 0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1 Accept-Encoding: gzip, deflate, compress;q=0.9 Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66 Keep-Alive: 300 Connection: keep-alive Cookie: toolkitAccess=1 HTTP/1.1 302 Found Date: Wed, 23 Jul 2003 10:04:55 GMT Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1 mod_perl/1.27 X-Powered-By: PHP/4.3.1 Location: http://someplaceelse.com Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: header headers_sent BUG
according to the php doc, online the headers are not affected by the Output Buffer, so any functions that manipulate the OB should have no effect. flush I do not beleive will fix this issue. (* I have tested it and it did not *) Still need a good way to accomplish this. Thanks, James Ivo Fokkema wrote: You might want to check whether or not your header output is getting buffered. My suggestion is a flush() after the fist call. I'm not an expert on this, it's just an idea. HTH -- Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands James M. Luedke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all: I am having a hard time with a small piece of code. I was wondering if someone may be able to explain why the following code will not work... I have been scratching my head for a few hours now and I am stumped. ?php header(Location: http://someplace.com;); if( ! headers_sent()) header(Location: http://somplaceelse.com;); ? So I would expect this piece of code to direct me to somplace.com. However it does not, and I always end up at somplaceelse.com. I have done a tcpdump to assist with debugging here is the output below. From the look of it the first header is getting ignored all toghether. Is there some way to force changes I made to the headers, that will make headers_sent return TRUE? Thanks, -James --- GET /tracking/test.php HTTP/1.1 Host: dev.www.someplace.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q= 0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1 Accept-Encoding: gzip, deflate, compress;q=0.9 Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66 Keep-Alive: 300 Connection: keep-alive Cookie: toolkitAccess=1 HTTP/1.1 302 Found Date: Wed, 23 Jul 2003 10:04:55 GMT Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1 mod_perl/1.27 X-Powered-By: PHP/4.3.1 Location: http://someplaceelse.com Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php