$Web Cookie Parm: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Value of cookie<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Value of cookie<section end="desc" /></span> | ||
$Web_Cookie_Parm takes four arguments and returns a string, or null for any error condition. <var>[[$Web_Get_Cookie]]</var> is a synonym for $Web_Cookie_Parm. | <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 $Web_Cookie_Parm. | ||
==Syntax== | ==Syntax== | ||
Line 22: | Line 22: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>$Web_Cookie_Parm returns the value of a cookie '''sent by the browser''' and is not affected by <var>$Web_Set_Cookie</var> calls before the $Web_Cookie_Parm call. | <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 "FOO" with a value of "PUB", in the following code: | 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') | <p class="code">%rc = $Web_Set_Cookie( 'FOO', 'BAR') |
Revision as of 20:03, 15 June 2012
<section begin="desc" />Value of cookie<section end="desc" />
$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
<section begin="syntax" /> %STRING = $Web_Cookie_Parm( name, occurrence, start, len ) <section end="syntax" />
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 which 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:
%rc = $Web_Set_Cookie( 'FOO', 'BAR') %FOO = $Web_Cookie_Parm( 'FOO' )
%FOO would be set to "PUB".
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' )