buildrelease
[openafs-wiki.git] / TWiki / VarURLPARAM.mdwn
1 <a name="VarURLPARAM"></a>
2
3 ### <a name="URLPARAM{&quot;name&quot;} -- get value of"></a> URLPARAM\{"name"\} -- get value of a URL parameter
4
5 - Returns the value of a URL parameter.
6 - Syntax: `%URLPARAM{"name"}%`
7 - Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
8   <tr>
9     <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
10     <th bgcolor="#99CCCC"><strong> Description: </strong></th>
11     <th bgcolor="#99CCCC"><strong> Default: </strong></th>
12   </tr>
13   <tr>
14     <td><code>"name"</code></td>
15     <td> The name of a URL parameter </td>
16     <td> required </td>
17   </tr>
18   <tr>
19     <td><code>default="..."</code></td>
20     <td> Default value in case parameter is empty or missing </td>
21     <td> empty string </td>
22   </tr>
23   <tr>
24     <td><code>newline="&lt;br /&gt;"</code></td>
25     <td> Convert newlines in textarea to other delimiters </td>
26     <td> no conversion </td>
27   </tr>
28   <tr>
29     <td><code>encode="entity"</code></td>
30     <td> Encode special characters into HTML entities. See [[Main/VarENCODE]] for more details. </td>
31     <td> no encoding </td>
32   </tr>
33   <tr>
34     <td><code>encode="url"</code></td>
35     <td> Encode special characters for URL parameter use, like a double quote into <code>%22</code></td>
36     <td> no encoding </td>
37   </tr>
38   <tr>
39     <td><code>encode="quote"</code></td>
40     <td> Escape double quotes with backslashes (<code>\"</code>), does not change other characters; required when feeding URL parameters into other TWiki variables </td>
41     <td> no encoding </td>
42   </tr>
43   <tr>
44     <td><code>multiple="on"</code> %BR% <code>multiple="[[$item]]"</code></td>
45     <td> If set, gets all selected elements of a <code>&lt;select multiple="multiple"&gt;</code> tag. A format can be specified, with <code>$item</code> indicating the element, e.g. <code>multiple="Option: $item"</code></td>
46     <td> first element </td>
47   </tr>
48   <tr>
49     <td><code>separator=", "</code></td>
50     <td> Separator between multiple selections. Only relevant if multiple is specified </td>
51     <td><code>"\n"</code> (new line) </td>
52   </tr>
53 </table>
54 - Example: `%URLPARAM{"skin"}%` returns `print` for a `.../view/%WEB%/%INCLUDINGTOPIC%?skin=print` URL
55 - **_%X% Notes:_**
56   - URL parameters passed into HTML form fields must be entity [[ENCODEd|Main/VarENCODE]].
57   - Double quotes in URL parameters must be escaped when passed into other TWiki variables.%BR% Example: `%SEARCH{ "%URLPARAM{ "search" encode="quotes" }%" noheader="on" }%`
58   - When used in a template topic, this variable will be expanded when the template is used to create a new topic. See [[TWikiTemplates#TemplateTopicsVars]] for details.
59   - Watch out for TWiki internal parameters, such as `rev`, `skin`, `template`, `topic`, `web`; they have a special meaning in TWiki. Common parameters and view script specific parameters are documented at [[TWikiScripts]].
60   - If you have `%URLPARAM{` in the value of a URL parameter, it will be modified to `%<nop>URLPARAM{`. This is to prevent an infinite loop during expansion.
61   - There is a risk that this variable could be misused for cross-site scripting.
62 - Related: [[ENCODE|Main/VarENCODE]], [[SEARCH|Main/VarSEARCH]], [[FormattedSearch]], [[QUERYSTRING|Main/VarQUERYSTRING]]