RE: [PHP] OO website/program doubt

2006-11-02 Thread Richard Lynch




On Wed, November 1, 2006 3:30 pm, bruce wrote:
 yo rich (or others)...

 does php provide the ability to store objects in a session var

As I just said (below, thanks to top-posting).

Yes, I think so.

You just need to be sure the require for the class definition happens
*BEFORE* the objects are instantiated, as I understand it.

/* Right Way */
require 'class_definitions_needed_for_objects_in_session_vars.class';
session_start();


At least, that's my interpretation of the posts I've seen from people
who actually use PHP OOP and cram objects into sessions. [shudder]

Resources (e.g., MySQL connections) are released at the end of a
script, and will not be resurrectable, at least not in PHP 4  5 as I
understand it.

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 01, 2006 1:16 PM
 To: Meghdad Azriel
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] OO website/program doubt


 On Wed, November 1, 2006 2:50 pm, Meghdad Azriel wrote:
 The objects in an OO website/program is always alive in the session,
 or they
 die at  the end of the execution of each page?

 They die and are resurrected like zombies on the next page.

 The Resurrection is slightly more complicated than that described in
 the Bible, however, requiring some serious gnarly timing issues in
 your loading of the class definitions before you attempt to use the
 objects...

 Probably best to load all your class definitions before you do
 session_start() from that perspective, though I don't know as I never
 use OOP much in PHP.

 You *could* write a daemon in PHP to have long-lived objects, however,
 if you want to keep them around for a long shelf life.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

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

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] OO website/program doubt

2006-11-02 Thread Eric Butera

On 11/2/06, Richard Lynch [EMAIL PROTECTED] wrote:


Resources (e.g., MySQL connections) are released at the end of a
script, and will not be resurrectable, at least not in PHP 4  5 as I
understand it.



Since this hasn't been said yet...

When working with resources, objects can use the __sleep and __wakeup
magic methods to close and re-create said resources.

http://us2.php.net/manual/en/language.oop.magic-functions.php

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



Re: [PHP] OO website/program doubt

2006-11-01 Thread Ed Lazor
No variable is part of session data, unless you specifically add it  
yourself.


Sorry, can't answer to AJAX, haven't had time to play with it.


On Nov 1, 2006, at 12:50 PM, Meghdad Azriel wrote:



Hello,

The objects in an OO website/program is always alive in the  
session, or they

die at  the end of the execution of each page?


and what about making something like this:
front-building-engine in javascript
AJAX tells to PHP the events
AJAX request and load data from PHP
PHP sends front-layout-specification


--
View this message in context: http://www.nabble.com/OO-website- 
program-doubt-tf2555845.html#a7122248

Sent from the PHP - General mailing list archive at Nabble.com.

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



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



Re: [PHP] OO website/program doubt

2006-11-01 Thread Richard Lynch
On Wed, November 1, 2006 2:50 pm, Meghdad Azriel wrote:
 The objects in an OO website/program is always alive in the session,
 or they
 die at  the end of the execution of each page?

They die and are resurrected like zombies on the next page.

The Resurrection is slightly more complicated than that described in
the Bible, however, requiring some serious gnarly timing issues in
your loading of the class definitions before you attempt to use the
objects...

Probably best to load all your class definitions before you do
session_start() from that perspective, though I don't know as I never
use OOP much in PHP.

You *could* write a daemon in PHP to have long-lived objects, however,
if you want to keep them around for a long shelf life.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] OO website/program doubt

2006-11-01 Thread bruce
yo rich (or others)...

does php provide the ability to store objects in a session var



-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 01, 2006 1:16 PM
To: Meghdad Azriel
Cc: php-general@lists.php.net
Subject: Re: [PHP] OO website/program doubt


On Wed, November 1, 2006 2:50 pm, Meghdad Azriel wrote:
 The objects in an OO website/program is always alive in the session,
 or they
 die at  the end of the execution of each page?

They die and are resurrected like zombies on the next page.

The Resurrection is slightly more complicated than that described in
the Bible, however, requiring some serious gnarly timing issues in
your loading of the class definitions before you attempt to use the
objects...

Probably best to load all your class definitions before you do
session_start() from that perspective, though I don't know as I never
use OOP much in PHP.

You *could* write a daemon in PHP to have long-lived objects, however,
if you want to keep them around for a long shelf life.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

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



Re: [PHP] OO website/program doubt

2006-11-01 Thread Ed Lazor
Yes.  Check the mailing list archive.  We just had a discussion about  
2 weeks ago that talked about this and gave a few examples.



On Nov 1, 2006, at 1:30 PM, bruce wrote:


yo rich (or others)...

does php provide the ability to store objects in a session var



-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 01, 2006 1:16 PM
To: Meghdad Azriel
Cc: php-general@lists.php.net
Subject: Re: [PHP] OO website/program doubt


On Wed, November 1, 2006 2:50 pm, Meghdad Azriel wrote:

The objects in an OO website/program is always alive in the session,
or they
die at  the end of the execution of each page?


They die and are resurrected like zombies on the next page.

The Resurrection is slightly more complicated than that described in
the Bible, however, requiring some serious gnarly timing issues in
your loading of the class definitions before you attempt to use the
objects...

Probably best to load all your class definitions before you do
session_start() from that perspective, though I don't know as I never
use OOP much in PHP.

You *could* write a daemon in PHP to have long-lived objects, however,
if you want to keep them around for a long shelf life.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

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



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



Re: [PHP] OO website/program doubt

2006-11-01 Thread Kevin Waterson
This one time, at band camp, bruce [EMAIL PROTECTED] wrote:

 
 does php provide the ability to store objects in a session var

yes
http://phpro.org/tutorials/Introduction-to-PHP-Sessions.html#8

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

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



Re: [PHP] OO website/program doubt

2006-11-01 Thread Chris

bruce wrote:

yo rich (or others)...

does php provide the ability to store objects in a session var


You just need to make sure you load the class before the session:

include('user_class.php');
...

session_start();

otherwise you get incomplete class errors.

--
Postgresql  php tutorials
http://www.designmagick.com/

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