$WBGC - get cookie
Availability
$WBGC is available for use with all WBSP commands.
Syntax
$WBGC{cookiename}
$WBGC[cookiename]
Parameters
cookiename - name of the cookie
Returns
Value of the HTTP cookie specified with
cookiename.
Example
File GetCookies.wbsp
[FormFields]
wb_command=R
wb_showlogo=F
<!--WB_BeginTemplate-->
<html>
<head><br><LINKhref="$wbif["$wbgc[css]"=""|style1.css|$wbgc[css]]" type=text/css rel=stylesheet>
<title>Cookie test</title>
</head>
<body>
Cookievalue:($wbgc[css])<br><br><ahref= "setcookie.wbsp?css=
style1.css">Style1</a><br><br><ahref="setcookie.wbsp?css=style2.css">Style 2</a>
</body>
</html>
File SetCookie.wbsp
[FormFields]
wb_command=R
wb_redirect=$wbe[http_referer]
wb_addcookie=CSS=$wbv{CSS}
File style1.css
body{
font-family:Verdana;
font-size:12px;
color:#333333;
background-color:#efefef;
}
a{
text-decoration:none;
color:#0065b7;
font-weight:bold;
}
a:hover{
color:#cc0000;
}
File style2.css
body{
font-family:Verdana;
font-size:12px;
color:#0000cc;
background-color:#ffffff;
}
a{
text-decoration:none;
color:#6500b7;
font-weight:bold;
}
a:hover{
color:#00cc00;
}
After running this example (file getcookies.wbsp) the page will change its
appearance depending on value of cookie named CSS (changed by clicking on links
"Style 1" and "Style 2").