Re: [PHP4BETA] Header() in PHP4
| From: | Mitch Vincent | Date: | Tue, 24 Aug 1999 22:59:56 +0000 |
| Subject: | Re: [PHP4BETA] Header() in PHP4 | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-3693@lists.php.net to get a copy of this message | ||
So use a HTML meta tag :
echo "<meta http-equiv=\"Refresh\" content=\"0; url=http://whatever\">";
The "0" there is the time it takes to refresh in seconds I believe, 0 is an
immediate redirect (actually there is a very small delay). I use it all the
time, works like a charm.
As far as the CF - PHP argument, I've seen nothing done in CF that couldn't
be done in PHP and vice versa, I'm sure there are such things, but I'm not
sure what they would be (if anyone knows or has examples, please send them
to me, I'm curious).. If you want to spend an outrageous amount of money for
a semi-bloated piece of software that virtually needs it's own machine, buy
CF, else download PHP! I used CF version 2-something, so it wasn't all that
great then, I've heard it's much better now.. *shrug*
To my limited knowledge the main advantage of CF is it's NT integration,
while PHP does run under M$ OSs, I'm not sure if it's as stable or feature
rich as the Unix version..
-Mitch
"When all your plans fail, backup, re-group and press on. The only real
failure is quitting..."
-----Original Message-----
From: Michael Stearne <MStearne@eisolutions.com>
To: php4beta@lists.php.net <php4beta@lists.php.net>
Date: Tuesday, August 24, 1999 6:10 PM
Subject: [PHP4BETA] Header() in PHP4
>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):
>
><HTML>
><body>
>This is something
>
><CFIF #VAR# is 3>
><CFLOCATION location="page.html">
></CFIF>
>
></body>
></html>
>
>Whereas PHP requires:
>
><?
>if($var==3)
>header("Location: page.html")
>?>
><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 <META> 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<script language=\"javascript\">\n";
>$Cookie.='function makeYearExpDate(yr){
>var expire = new Date();
>expire.setTime(expire.getTime() + ((yr *365) *24 * 60 * 60 * 1000));
>expire = expire.toGMTString()
>return expire
>}
>expr =makeYearExpDate('.$CExpr.');';
>$Cookie.="\n".$CookieString."\n";
>$Cookie.="document.cookie=astr;\n</script>\n";
>}else{
>//$CookieString="astr= '$CName' + '=' + '$CValue' +
>';expires=;path=/';";
>$Cookie.="\n<script language=\"javascript\">\n";
>$Cookie.="document.cookie='$CName=$CValue;path=/';";
>$Cookie.="\n</script>\n";
>}
>echo $Cookie;
>}
>
>--
>PHP 4 Beta
>
>