Re: [Phplib-users] how to save array pointer with phplib
Brought to you by:
nhruby,
richardarcher
From: nathan r. h. <na...@ds...> - 2002-02-08 13:41:46
|
Yeppers, phplib serializes the data in your array and stores it to whatever container you've setup (file, db, etc..) when the session object unserializes your array and "re-constitutes" it and really does that, it makes a new array with the name found in persistent_slot and then re-adds the serailized data to it. Your method of saving the pointer postion is what you need to do. I don't think that you can actually "save" a pointer, so you may want to find the current location in the array, determinie it's index number and save that. I think this would be a good feature to have for phplib to do transparently, please file a SF Feature Requiest for it adn we'll try to get it in to a future release. -n ------ nathan hruby na...@ds... ------ On Fri, 8 Feb 2002, Marko Kaening wrote: > Hi, > > I tried to save an array inside a class which should be able to save its > variables using phplib. As persistent slot I took the array "list" as > shown in the snip-out of my code below. > > The problem is that the list certainly gets properly saved, but the > pointer got lost... Though the class gets saved after reloading its state > with a new page changes made to the current position in the array are > forgotten. I mean, if I cycled with next() and prev() through the array > "list" I always start at the first entry the class got reloaded... Too > sad. > > Does anybody know how to save the pointer to the current element? > Looks like one needs to get the current position inside the array and then > to treat this as a seperate entry in the "persistent_slots"! > > Any comments are welcome. Maybe I ve overseen something, but maybe this is > a principle problem for phplib, being unable to save the actual state of > an array object. > > Thanks in advance, > Marko > > > -- SNIP --- > > class StepItClass > { > var $classname= 'StepItClass'; > var $persistent_slots = array( > 'list' > ); > > #------------------------------------------------------------ > # persistent variables: > > var $list=array(); > ... > > > > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > |