$Web Cookie Parm: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Cookie_Parm}}
{{DISPLAYTITLE:$Web_Cookie_Parm}}
<span class="pageSubtitle"><section begin="desc" />Value of cookie<section end="desc" /></span>
<span class="pageSubtitle">Value of cookie</span>
 
<var>$Web_Cookie_Parm</var> takes four arguments and returns a string, or null for any error condition. <var>[[$Web_Get_Cookie]]</var> is a synonym for <var>$Web_Cookie_Parm</var>.


$Web_Cookie_Parm retrieves the value of a cookie.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %STRING = $Web_Cookie_Parm( name, occurrence, start, len )
<p class="syntax"><span class="term">%string</span> = <span class="literal">$Web_Cookie_Parm</span>( <span class="term">name</span>, <span class="term">occurrence</span>, [<span class="term">start</span>]], [<span class="term">len</span>] )
<section end="syntax" /></p>
</p>
 


$Web_Cookie_Parm takes four arguments and returns a string, or null for any error condition. $Web_Get_Cookie is a synonym for $Web_Cookie_Parm.
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>name</th>
<tr><th>name</th>
<td>The name of the cookie, returned by $Web_Cookie_Name. A required argument if occurrence is not specified, otherwise it is optional.</td></tr>
<td>The name of the cookie, returned by <var>[[$Web_Cookie_Name]]</var>. A required argument if occurrence is not specified, otherwise it is optional.</td></tr>
<tr><th>occurrence</th>
<tr><th>occurrence</th>
<td>The occurrence number of a cookie, or the occurrence number of the cookie matching ''name'', if name is specified. An optional argument if ''name'' is specified, otherwise it is required.</td></tr>
<td>The occurrence number of a cookie, or the occurrence number of the cookie matching ''name'', if name is specified. An optional argument if ''name'' is specified, otherwise it is required.</td></tr>
<tr><th>start</th>
<tr><th>start</th>
<td>Starting position within the name. This is an optional argument which defaults to 1.</td></tr>
<td>Starting position within the name. This is an optional argument that defaults to 1.</td></tr>
 
<tr><th>len</th>
<tr><th>len</th>
<td>Length to return. This is an optional argument, provided in case a cookie exceeds 255 bytes. The length of a cookie can be determined with $Web_Cookie_Len. The default is the length of the cookie.
<td>Length to return. This is an optional argument, provided in case a cookie exceeds 255 bytes. The length of a cookie can be determined with <var>$Web_Cookie_Len</var>. The default is the length of the cookie.
</td></tr></table>
</td></tr></table>


==Usage notes==
<ul>
<li><var>$Web_Cookie_Parm</var> returns the value of a cookie '''sent by the browser''' and is not affected by <var>$Web_Set_Cookie</var> calls before the <var>$Web_Cookie_Parm</var> call.
For example, if a browser sent a cookie called <code>FOO</code> with a value of <code>PUB</code>, in the following code, <code>%FOO</code> would be set to <code>PUB</code>:
<p class="code">%rc = $Web_Set_Cookie( 'FOO', 'BAR')
%FOO = $Web_Cookie_Parm( 'FOO' )
</p>
</ul>


 
==Examples==
This example places the value of each cookie into a User Language %variable of the same name.
This example places the value of each cookie into a <var class="product">User Language</var> %variable of the same name.
<p class="code"> %ARTIST = $Web_Cookie_Parm( 'ARTIST' )
<p class="code"> %ARTIST = $Web_Cookie_Parm( 'ARTIST' )
  %GENRE = $Web_Cookie_Parm( 'GENRE' )
  %GENRE = $Web_Cookie_Parm( 'GENRE' )
</p>
</p>


 
==See also==
$Web_Cookie_Parm returns the value of a cookie '''sent by the browser''' and is not affected by $Web_Set_Cookie calls before the $Web_Cookie_Parm call.
For example, if a browser sent a cookie called "FOO" with a value of "PUB", in the following code
<p class="code"> %RC = $Web_Set_Cookie( 'FOO', 'BAR')
%FOO = $Web_Cookie_Parm( 'FOO' )
</p>
%FOO would be set to "PUB".
 
See also:
<ul>
<ul>
 
<li>[[Janus Web Server application coding considerations#Understanding cookies|"Understanding cookies"]]
<li><var>[[$Web_Cookie_Len]]</var>  
<li><var>[[$Web_Cookie_Len]]</var>  
<li><var>[[$Web_Cookie_Name]]</var>  
<li><var>[[$Web_Cookie_Name]]</var>  
<li><var>[[$Web_Num_Cookie]]</var>  
<li><var>[[$Web_Num_Cookie]]</var>  
<li><var>[[$Web_Set_Cookie]]</var>  
<li><var>[[$Web_Set_Cookie]]</var>  
<li>
<li><var>[[$Web_Get_Cookie_Lstr]]</var>  
<li><var>[[$Web_Get_Cookie_Lstr]]</var>  
<li><var>[[$Web_Set_Cookie_Lstr]]</var>
<li><var>[[$Web_Set_Cookie_Lstr]]</var>

Latest revision as of 17:20, 16 April 2013

Value of cookie

$Web_Cookie_Parm takes four arguments and returns a string, or null for any error condition. $Web_Get_Cookie is a synonym for $Web_Cookie_Parm.

Syntax

%string = $Web_Cookie_Parm( name, occurrence, [start]], [len] )

Syntax terms

name The name of the cookie, returned by $Web_Cookie_Name. A required argument if occurrence is not specified, otherwise it is optional.
occurrence The occurrence number of a cookie, or the occurrence number of the cookie matching name, if name is specified. An optional argument if name is specified, otherwise it is required.
start Starting position within the name. This is an optional argument that defaults to 1.
len Length to return. This is an optional argument, provided in case a cookie exceeds 255 bytes. The length of a cookie can be determined with $Web_Cookie_Len. The default is the length of the cookie.

Usage notes

  • $Web_Cookie_Parm returns the value of a cookie sent by the browser and is not affected by $Web_Set_Cookie calls before the $Web_Cookie_Parm call. For example, if a browser sent a cookie called FOO with a value of PUB, in the following code, %FOO would be set to PUB:

    %rc = $Web_Set_Cookie( 'FOO', 'BAR') %FOO = $Web_Cookie_Parm( 'FOO' )

Examples

This example places the value of each cookie into a User Language %variable of the same name.

%ARTIST = $Web_Cookie_Parm( 'ARTIST' ) %GENRE = $Web_Cookie_Parm( 'GENRE' )

See also