05-06-2008, 02:26 PM
|
#8 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
|
well, i just read some of the stuff on that link you gave, to the singleton stuff...
if i understood it right..
their example:
Code:
<?php
static function borrowBook() {
if (FALSE == self::$isLoanedOut){
if (NULL == self::$book){
self::$book = new BookSingleton();
}
self::$isLoanedOut = TRUE;
return self::$book;
}else{
return NULL;
}
}
?>
is the key to do the loading right
so in my case, i would call and set my session class in this mannor, and use it in my user class, which is extended from my mysql class...
using something like their example
Code:
<?php
function borrowBook(){
$this->borrowedBook = BookSingleton::borrowBook();
if ($this->borrowedBook == NULL) {
$this->haveBook = FALSE;
}
else
{
$this->haveBook = TRUE;
}
}
?>
right? obviously not THAT code, but i've already got an idea how to set it up... i'll go play with it, and come back and see what someone has to say
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
|
|
|