Lasso Soft Inc. > Home


AuthorBil Corry
LicensePublic Domain
Posted12 Feb 2006
Updated03 Dec 2007
More by this author...


Returns all session vars, or if a session name is specified, just the vars for that session name.

Requires [lp_session_id]

Sample Usage


session_start: -name='test_session1', -uselink;
session_start: -name='test_session2', -uselink;
session_addvar: -name='test_session1', 'test1';
session_addvar: -name='test_session2', 'test2';
session_addvar: -name='test_session1', 'test3';
session_addvar: -name='test_session2', 'test4';
var:'test5'='not stored in session';
var:'test6'='not stored in session';

Sessions Example

Session IDs as reported by Lasso Session ID #1 = [session_id: -name='test_session1'] Session ID #2 = [session_id: -name='test_session2']
Session IDs as reported by lp_session_id ['[lp_session_id] = '][lp_session_id] ['[lp_session_id: -vars] = '][lp_session_id: -vars] ['[lp_session_id: -form] = '][output: (lp_session_id: -form)] ['[lp_session_id: -form, -xhtml] = '][output: (lp_session_id: -form, -xhtml)] ['[lp_session_id: -url] = '][lp_session_id: -url]
Session IDs added by Lasso (view source) forms:
links: link1 link2
Redirect Test [ if: (action_param:'r') == '1'; redirect_url:'sessiontest.lasso'; else: (action_param:'r') == '2'; lp_session_redirect:'sessiontest.lasso'; /if; 'Normal redirect\r\n'; 'Session redirect\r\n'; ]
Session Vars All Sessions = [lp_session_vars] Session ID #1 = [lp_session_vars: 'test_session1'] Session ID #2 = [lp_session_vars: 'test_session2']

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.


	-description='Returns all session vars, or if a session name is specified, just the vars for that session name.',
	local:'vars' = array;
	local:'session' = array;
	local:'varnames' = array;
	if: local_defined:'session_name';
		#session->(insert: '_SessionTracker_' #session_name '_Vars');
		// get session name and session ID as an array of pairs
		#session = (lp_session_id: -vars);
		// get just the name of the session
		#session->(foreach: {params->first = params->first->name; Return: True;} );
		// now get the variable name that stores the session variable names
		#session->(foreach: {params->first->(append:'_Vars'); Return: True;} );
	iterate: #session, local:'i';
		if: (var: #i)->type == 'array';
			#varnames->(merge: (var: #i));

	if: local_defined:'string';
		iterate: #varnames, local:'i';
			#vars->(insert: #i + '=' + (var: #i));
		return: #vars->(join:', ');


		iterate: #varnames, local:'i';
			#vars->(insert: #i = (var: #i));
		return: #vars;




Related Tags


No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft