Hi PeterOblivion!
On Tue, 26 Jun 2001, [EMAIL PROTECTED] wrote:

> I need a class that can quickly help me set cookies and sessions, and check 
> up against them
> 
> anyone have an idea where i can get one like this?
> 
yes

http://www.webdev.ro/products/phpx/phpx.tgz

luckily enough, Daniel ([EMAIL PROTECTED]) put it up on this site so others can have access
to it.

it includes only the sources w/ no docs, but a simple example follows.
quick jumps to the colorful sources are:

 -> http://www.webdev.ro/products/phpx/code.php?file=ScriptletRequest.php
 -> http://www.webdev.ro/products/phpx/code.php?file=ScriptletResponse.php
 -> http://www.webdev.ro/products/phpx/code.php?file=Session.php

$request  = new HttpScriptletRequest();
$response = new HttpScriptletResponse();

$a_variable = $request->getAttribute('variable.name');
$a_cookie   = $request->getCookie('baubau');
etc.
the full API of request is a bigger, just have a look, and quite easy to use.

/* for `slash trick' browsing u can use this: */
$request->setPathMapping('/module.name/module.entry/module.info');    

if ($request->getAttribute('module.name') == 'News') {
            // do stuff
}

an so, for an url like: http://www.foo.com/News/ShowNews/123

you have the mapping:
        'module.name' -> News
        'module.entry' -> ShowNews
        'module.info'  -> 123

of course u can use any name, just separate them with `/'.
   
/* for session support */

    $session = $request->getSession();    
    $someCart = new Cart();
// to save it to the session
    $session->setAttribute('cart.items', $someCart); 
// to get it (AS A COPY - changes aren't saved)
    $otherCart = $session->getAttribute('cart.items');    
// to get it AS A REFERENCE (changes are saved)
    $otherCart =& $sesion->getAttribute('cart.items');


You can use a $Request object as a containter/spacename for your variables
along the request processing to have a more elegant variables control, IMO.

Play with it, enhance it and share if you like :)

-- teodor

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to