Re: Maintaining state [message #4940 is a reply to message #4937] |
Thu, 27 August 2015 06:08 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
If you look at the initSession() function inside include.session.inc you will see that it looks for an entry in $_SESSION['pages'][$PHP_SELF]), and then extracts $_SESSION['pages'][$PHP_SELF][$task_id] into a global variable called $script_vars. The contents of $script_vars is then extracted into individual variables such as $where, $search, et cetera.
There is a separate copy of $script_vars for each script and this is is constructed BEFORE the script is called by the calling script. This means that if script "A" calls script "B" then $script_vars for "B" will be constructed by "A" using the scriptNext() function, and this will include any arguments that need to be passed from "A" to "B". When control is passed from "A" to "B" the $script_vars for "A" will remain in $_SESSION so that when control is returned to "A" it will be able to resume from where it left off. When "B" terminates the scriptPrevious() function will cause $script_vars for "B" to be dropped (unless the "Keep data" option on MNU_TASK is set), update the $script_vars for "A" with any values that need to be returned, then cause "A" to be reactivated. Script "A" will then be able to resume from where it left off, but now it will also have any values that were returned from script "B".
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|