RE: [PHP] How to preserve object with session
| From: | Przem Kowalczyk | Date: | Mon, 10 Jul 2000 07:01:02 +0000 |
| Subject: | RE: [PHP] How to preserve object with session | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5692@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Teodor Cimpoesu [mailto:teo@digiro.net]
> Sent: Friday, July 07, 2000 4:20 PM
> To: Php4
> Subject: Re: [PHP] How to preserve object with session
>
>
> Hi Przem!
> On Fri, 07 Jul 2000, Przem Kowalczyk wrote:
>
> > Oki. A working example:
> >
> > include ("class.Job.php");
> >
> > session_register('job');
> > if (!is_object($job))
> > {
> > $job = new Job('job','BODY');
> > }
> > echo "back: " .$job -> test . "<br>";
> > $job -> test++;
> > $job -> set_block('employee','EMPLOYEE');
> > $page = new Page('page');
> > $page -> set_child($job);
> > $page -> eParse();
> > $page -> ePrint();
> >
> >
> > if i reload the page i got:
> >
> > Fatal error: Call to undefined function: set_block() in
> > /www/virtual/przem/b2b/htdocs/jobs/employee.php on line 11
> hmm, looks like it tries to call the set_block() function not
> the method (for an unknown method the error message is different, IIRC)
It was an error message for undefined method, but...
> can you include the class definition(s) in one file and provide
> a `reproduceable' example?
> (e.g. in vi,
:1 r class.Job.php'. Also where is your
> Page'
> class defined?)
you were absolutely right about the rest.
I launched session before this script, in auto_prepend file
Thanks for your help
Przem