Lasso Soft Inc. > Home

[var_define]

Linkvar_define
AuthorShelane French
CategoryVariable
Version8.5.x
LicensePublic Domain
Posted11 Mar 2014
Updated11 Mar 2014
More by this author...

Description

Modified from the Lasso siteAdmin tags, this tag allows you to define a variable, assign it to a session, validate when setting from an action parameter, force a value, and set a default value.

Sample Usage

var_define('route', -default=string, -override=action_param('route'), -validate=array('login', 'settings', 'session', 'interest', 'search'));
var_define('legal', -override=action_param('legal'), -session='mysession');

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.

define_tag('define', -Namespace='var_', -required='name', -optional='default', -optional='session', -optional='override', -optional='force', -optional='validate', -type='array', -priority='replace');
	if(local_defined('force'));
		var(#name = #force);
	else(local_defined('override') && #override != '' && local_defined('validate') && #validate->size);
		if(#validate >> #override);
			var(#name = #override);
		else(local_defined('default'));
			var(#name = #default);
		else;
			var(#name = '');
		/if;
	else(local_defined('override') && #override != '');
		var(#name = #override);
	else(local_defined('default') && var(#name) == '' && #default != '');
		var(#name = #default);
	else(var_defined(#name) == false || var(#name) == null);
		var(#name = '');
	/if;
	if(local_defined('session') && #session != '');
		session_addvar(-name=#session, #name);
	/if;
/define_tag;

Comments

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