Re: [PHP4BETA] Header() in PHP4

From: Date: Wed, 25 Aug 1999 06:19:17 +0000
Subject: Re: [PHP4BETA] Header() in PHP4
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-3704@lists.php.net to get a copy of this message
Zeev Suraski wrote: > > Compiling the script prior to executing it has little to do with this > functionality, because header() is called in runtime (it's affected by > control structures such as if statements). > However, PHP 4.0 is equipped with an output abstraction layer, that > supports output buffering. Among other things, it means it's supported in > PHP 4.0. It is possible to support, or it is supported? The header() function may be ambigious. I am talking more of a location() function which changes to the location specified at once. Michael > > Zeev > > At 23:53 24/08/99 , Michael Stearne wrote: > >People ask about the differences between PHP and Cold Fusion regularly. > >One thing that I liked about Cold Fusion was the CFLOCATION tag, which > >is works like the header() tag in PHP. > >One big difference between the CFLOCATION and header is that it is > >possible to have HTML and output on a page before the tag is called. For > >example (I am unsure of CF syntax): > > > >This is something > >Whereas PHP requires: > > > ><? > >if($var==3) > >header("Location: page.html") > >?> > >.... Either way is easy to use, but there is sometimes an advantage in > >running some output before the page is redirected. I know this can be done > >with a tag, but I don't like the fact that the user can hit Stop on the > >browser. The reason why I am asking about this feature in PHP4 is because > >I (maybe wrong) am under the impression the script is "compiled" > >completely before output is sent to the browser. I don't believe this was > >the case with 3. And I believe this is the way CF works. Sooo, is there > >anyway that this functionality can be added to version 4. This would also > >be a valuable feature for the SetCookie function. I don't always have the > >opportunity to set a cookie before any output has been sent consequently I > >use a function JSSetCookie(below) which works like SetCookie but prints > >Javascript out for the browser to pick up on. But that requires the user > >to have JS on. Any thoughts? Michael Stearne > >--------------------------------------------------------------------------- > >---- function JSSetCookie($CName,$CValue,$CExpr=FALSE){ // $CXpr is in > >years // Will allow cookies to be set even after HTML has been printed on > >the page if($CExpr!=FALSE){ $CookieString="astr= '$CName' + '=' + > >'$CValue' + ';expires=' + expr + ';path=/';"; > >$Cookie.="\n\n"; }else{ > >//$CookieString="astr= '$CName' + '=' + '$CValue' + > >';expires=;path=/';"; > >$Cookie.="\n\n"; } echo $Cookie; } -- PHP 4 Beta > > -- > Zeev Suraski <zeev@zend.com> http://www.zend.com/ > For a PGP public key, finger bourbon@netvision.net.il

« previous php.version4 (#3704) next »