[lp_client_param]

Description

Link: [lp_client_param]
Author: Bil Corry
Category: Client
Version: 8.x
License: Public Domain
Posted: Dec. 23, 2005
Updated: Oct. 30, 2006
More by this author...
Returns the value of a client GET/POST parameter.

Requires [lp_client_params], [lp_logical_between]

Parameters

-param string, required Client GET/POST parameter name.
-index integer, optional For repeating params, returns the occurance specified by -index.
-method string, optional -method='GET' for GET param, -method='POST' for POST param. Default is both.
-count boolean, optional Tag will return the number of repetitions when specified.

Sample Usage

lp_client_param:'hello';
						

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[

define_tag:'lp_client_param',
	-description='Returns the value of a client GET/POST parameter.',
	-priority='replace',
	-required='param',
	-optional='index',
	-optional='method',
	-optional='count';

	// save error so we won't overwrite it with our protect below
	local:'_ec' = error_code;
	local:'_em' = error_msg;
	lp_error_clearError;

	if: !(local_defined:'method');
		local:'method' = 'both';
	/if;

	local:'param_count' = (lp_client_params: #method)->(find: #param)->size;

	if: (local_defined:'count');
		// restore the error, if any
		error_code = #_ec;
		error_msg  = #_em;
		return: #param_count;
	/if;
	
	if: #param_count == 0;
		// restore the error, if any
		error_code = #_ec;
		error_msg  = #_em;
		return: string;
	/if;
	
	protect;
		handle: true;
			if: error_code != (error_noerror: -errorcode);
				// restore the error, if any
				error_code = #_ec;
				error_msg  = #_em;
				return: string;
			/if;
			// restore the error, if any
			error_code = #_ec;
			error_msg  = #_em;
		/handle;
	
		if: (local_defined:'index');
			if: (lp_logical_between: (integer:#index), 1, #param_count);
				return: (lp_client_params: #method)->(find: #param)->(get: (integer:#index))->value;
			else;
				return: string;
			/if;
		/if;
		
		local:'return' = array;
	
		iterate: (lp_client_params: #method)->(find: #param), local:'p';
			#return->(insert: #p->value);
		/iterate;
		#return = #return->(join:'\r');
		
		if: #return->size == 0;
			return: string;
		else;
			return: #return;
		/if;
	/protect;

/define_tag;

]

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular