export_url_vars (public, deprecated)
export_url_vars [ -sign ] [ args... ]
Defined in packages/acs-tcl/tcl/deprecated-procs.tcl
Deprecated. Invoking this procedure generates a warning.
export_vars is now the preferred interface. Returns a string of key=value pairs suitable for inclusion in a URL; you can pass it any number of variables as arguments. If any are defined in the caller's environment, they are included. See also export_entire_form_as_url_vars.
Instead of naming a variable you can also say name=value. Note that the value here is not the name of a variable but the literal value you want to export e.g.,
export_url_vars [ns_urlencode foo]=[ns_urlencode $the_value].For normal variables, you can say
export_url_vars foo:multiple. In this case, the value of foo will be treated as a Tcl list, and each value will be output separately e.g., foo=item0&foo=item1&foo=item2...You cannot combine the foo=bar syntax with the foo:multiple syntax. Why? Because there's no way we can distinguish between the :multiple being part of the value of foo or being a flag intended for export_url_vars.
- Switches:
- -sign (optional, boolean)
- If this flag is set, all the variables output will be signed using
ad_sign. These variables should then be verified using the :verify flag toad_page_contract, which in turn usesad_verify_signature. This ensures that the value hasn't been tampered with at the user's end.- See Also:
- Testcases:
- No testcase defined.
Source code: ad_log_deprecated proc export_url_vars set params {} foreach var_spec $args { if { [string first "=" $var_spec] != -1 } { # There shouldn't be more than one equal sign, since the value should already be url-encoded. lassign [split $var_spec "="] var value lappend params "$var=$value" if { $sign_p } { lappend params "[ns_urlencode [ns_urldecode $var]:sig]=[ns_urlencode [ad_sign [ns_urldecode $value]]]" } } else { lassign [split $var_spec ":"] var type upvar 1 $var upvar_value if { [info exists upvar_value] } { switch -- $type { multiple { foreach item $upvar_value { lappend params "[ns_urlencode $var]=[ns_urlencode $item]" } } default { lappend params "[ns_urlencode $var]=[ns_urlencode $upvar_value]" } } if { $sign_p } { lappend params "[ns_urlencode "$var:sig"]=[ns_urlencode [ad_sign $upvar_value]]" } } } } return [join $params "&"]XQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-tcl/tcl/deprecated-procs.xql