NYCPHP Meetup

[nycphp-talk] A tale of 4 scopes

Kenneth Downs ken at secdat.com
Wed Jan 17 09:39:15 EST 2007


There is a particular feature that I've tried to implement with varying 
success.  I'm wondering if anybody else has tried.

The idea centers around scope.  In a web app, it seems to me there are 
three recognized scopes, plus a fourth one nobody talks about much:

1)  Application/Database scope - data available to all users simultaneously
2)  Session Scope - data available to one browser instance (with all of 
its tabs and windows)

3)  Window/Tab Scope ( The one I'm trying to implement )

4) Request Scope, the GET/POST parameters of a single request.


We're interested in a solution for #3, the ability to distinguish 
between the various windows or tabs that a user has open.

I have a partial solution but I don't like it because it is fragile 
(besides being partial).  In this solution, you send a hidden variable 
to the browser that contains the "state" for that window.  Among the 
many problems of this approach is that every link must be a FORM 
submission so that the variable goes back to the server.  It does work 
very well for us in one very particular situation, but it is hardly a 
general solution.

The difficulty stems from the fact that there is no "window cookie" or 
"tab cookie", at least not as far as I know.  If there were, that would 
solve the whole problem.  I've thought of trying to trick PHP's system 
of writing a cookie into the URL, but since it is not meant to do that 
it would probably keeping wanting to do the wrong thing. 

Anybody else tried this?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ken.vcf
Type: text/x-vcard
Size: 261 bytes
Desc: not available
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070117/d09dddc8/attachment.vcf>


More information about the talk mailing list