NYCPHP Meetup

NYPHP.org

Yahoo! Switches To PHP

Marty.Hickey at ogilvy.com Marty.Hickey at ogilvy.com
Tue Oct 29 17:30:47 EST 2002



I don't know if you have seen on http://www.slashdot.org that the lead
article is that Yahoo has switched their backend to PHP. Here's the main
presentation given at PHPCon.
http://public.yahoo.com/~radwin/talks/yahoo-phpcon2002.htm

Marty




Adam Fields <fields at surgam.net> on 10/29/2002 05:08:33 PM

Please respond to talk at nyphp.org

To:    NYPHP Talk <talk at nyphp.org>
cc:
Subject:    Re: [nycphp-talk] More Client-Side Grief


On Tue, Oct 29, 2002 at 04:36:20PM -0500, Hans Zaunere wrote:
> After picking bits from each post, I've finally done something like:
>
> -- the PHP script that handles the form POST prints this to the popup:
>
> <script language="JavaScript">
>    if( opener ) {
>       opener.location.assign('<?=$next?>');
>       opener.location.reload(true);
>       window.close();
>    } else {
>       window.location.assign('<?=$next?>');
>    }
> </script>

I have one further enhancement to suggest, drawn from a function I use
elsewhere. In the latter case, if the headers have not yet been sent,
you'll want to use PHP to generate a redirect header for you instead
of loading the page and redirecting with javascript. This is basically
what I'm thinking, although I have yet to test it to see if it works
consistently:

--------------------

function REDIRECT ($url)
{
  if (substr($url, 0, 7) != 'http://') {
    if (substr($url, 0, 1) == '/') {
      $url = 'http://'.$_SERVER['HTTP_HOST'].$url;
    } else {
      $url = 'http://'.$_SERVER['HTTP_HOST'].'/'.$url;
    }
  }
  if (!headers_sent()) {
    header('Location: '.$url);
  } else {
    print '<script>';
    print "location.href='".$url."';";
    print '</script>';
  }
}

> where $next is where I want the main browser window to go.  I had
> considered passing the next URL in through the JavaScript call to
> create the popup (and this does seem to give the most flexibility), but
> really wanted to maintain my redirects from the server (I have a DB of
> "if posted from there, you now go here" that changes frequently).  This
> isn't as direct as sending a HTTP header, but heck, it seems to work
> (and still covers non-popups).

I got most of the functionality of my session-based jumpback stack
working today. Don't know if that'll help you at all.

> Ideally, I would have wished there was a way to read the HTTP headers
> sent from PHP into JavaScript/JScript and then act on them.  Supposedly
> there is
> (
http://msdn.microsoft.com/workshop/author/dhtml/reference/constants/response_headers.asp
)
> but as with so much client-side, I could never get them to do anything.
> :)
>
> Thanks again,
>
> H
>
>
>
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
>
>
>
>
>
>

--
                        - Adam

-----
Adam Fields, Managing Partner, fields at surgam.net
Surgam, Inc. is a technology consulting firm with strong background in
delivering scalable and robust enterprise web and IT applications.
http://www.adamfields.com


--- Unsubscribe at http://nyphp.org/list ---







-------------- next part --------------
----------------------------------------- (on bravo)

Privileged/Confidential Information may be contained in this message.  
If you are not the addressee indicated in this message (or responsible 
for delivery of the message to such person), you may not copy or 
deliver this message to anyone. In such case, you should destroy this message 
and kindly notify the sender by reply email. Please advise immediately 
if you or your employer does not consent to email for messages of this 
kind.  Opinions, conclusions and other information in this message that 
do not relate to the official business of the Ogilvy Group shall be 
understood as neither given nor endorsed by it.

---------------------------------------------------------


More information about the talk mailing list