What is the proper way to transfer class properties through-out my pages...

let's say i have a ShoppingCart Class and i have methods like
addToCart(id, qty) and deleteFromCart(id)
also i have properties like CartItems("id" => array(), "qty"=> array())

this is what i do...

//when the user enters my site, i do some...
if (!session_is_registered("myCart")){
    $myCart = new ShoppingCart();
    .... (some other stuffs...)
else {
    $myCart = new ShoppingCart();

if the object in the session is not present
i would create an instance and then register 
it to the session.
else if it is present, i would just reconstruct it...
because if i don't, even though it is in the 
sessions, the properties and methods are 
not constructed (no handler, i don't know how 
to call it).

my code works, but is there any other way
to do this, because i think it's kinda slow.... 

another question, is it ok to have a database-driven
shopping cart? i make use of the database to as the 
actual cart holder?

i need your opinions on these....


Brian Feliciano

i lost my connection to the list for a while, so
i have never heard your answers, please post it again or
email it to me directly..


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to