[client_param_9]

Description

Link: [client_param_9]
Author: Jolle Carlestam
Category: Client
Version: 9.x
License: Public Domain
Posted: Oct. 13, 2009
Updated: Jan. 01, 0001
More by this author...
A replacement for action_param. Retains its value even when used inside inlines. Returns the value of a client GET/POST parameter Inspired by Bil Corrys lp_client_param Requires the tag client_params. (On Tagswap called client_params_9.)

Parameters

-param string, required
-index integer, optional
-method string, optional post|get
-count boolean, optional

Sample Usage

client_param('my');
client_param('my', 2);
client_param('my', 'get');
client_param('my', 2, 'post');
client_param('my', -count);
client_param('my', 'get', -count);
						

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
<?LassoScript
/**
Returns the value of a client GET/POST parameter

Example usage
client_param('my');
client_param('my', 2);
client_param('my', 'get');
client_param('my', 2, 'post');
client_param('my', -count);
client_param('my', 'get', -count);

Inspired by Bil Corrys lp_client_param

*/
define client_param(param::string, -count::boolean = false) => {
	return client_param(#param, -1, '', -count=#count);
}
define client_param(param::string, method::string, -count::boolean = false) => {
	return client_param(#param, -1, #method, -count=#count);
}
define client_param(param::string, index::integer, method::string = '', -count::boolean = false) => {

	local(output) = array;

	client_params(#method) -> foreach => {
		(#1 -> type == 'pair' && #param == #1 -> name) ?
			#output -> insert(#1 -> value);
	}

	#count ? return #output -> size;

	#index <= 0 ? return #output -> join('\r');

	#index > 0 && #output -> size >= #index ? return #output -> get(#index);

	return string;
}

?>

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net