Lasso Soft Inc. > Home

[xs_url]

Linkxs_url
AuthorJonathan Guthrie
CategoryData Type
Version8.x
LicensePublic Domain
Posted01 Jun 2007
Updated01 Jun 2007
More by this author...

Description

Stores an array of url components, incorporates tags to add components, remove, or tuncate... and to return an assembled path.

Sample Usage

local('urlis' = xs_url);
#urlis->ops(-depth=integer(field('depth')),-component=(field('page_url')));
''(field('name'))'';

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_type('url',
	'array',
	-namespace = 'xs_',
	-prototype,
	-description = 'provides a type storing an array of url components, and incorporates tags to add components, remove, or tuncate... and to return an assembled path.');
	
	define_tag('restart', 
		-description='destroys/empties the thingie');
		self->removeall;
	/define_tag;

	define_tag('reduce', 
		-Required = 'by',
		-description = 'truncates x items from the tree');
		loop(#by);
			self->removelast;
		/loop;
	/define_tag;

	define_tag('ops', 
		-Required = 'depth',
		-Required = 'component',
		-description = 'compares and works out what to do with it...');
		
		if(#depth == 0);
			self->restart;
			self->insert(#component);
		else(#depth > (self->size - 1));
			self->insert(#component);
		else(#depth < (self->size - 1));
			self->reduce(-by=(self->size - #depth));
			self->insert(#component);
		else(#depth == (self->size - 1));
			self->reduce(-by=1);
			self->insert(#component);
		/if;
	/define_tag;

	define_tag('assemble', 
		-returnType = 'string', 
		-description = 'returns an assembled path from root in the format of /hello/world/how/are/you/');
		local('out' = '/');
		iterate(self,local('temp'));
			#out += #temp;
			#out += '/';
		/iterate;
		return(@#out);
	/define_tag;
		
/define_type;

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