<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>XtGem.com</title>
</head>
<body style="">
    <div data-xtcontainer="container" class="xt_container">
<!--parser:xtscript-->
# cookie settings
assign $name=test_new
assign $path=/manual/basics/plugins/cook
assign $expire=3600
assign $force_current=1

# Initialize value
assign $val=0

# delete or set 
get del
if not $del

# Get the value of the cookie into $val and increment it
assign $val= call cookie::get $name=$name;$default=0
assign $val=($val+1)

# Set the cookie to the new value
call cookie::set $name=$name; $val=$val; $expire=$expire;$path=$path; $force_current=$force_current
else

# Or delete the cookie
call cookie::delete $name=$name;$path=$path; $force_current=$force_current
#call cookie::set $name=$name; $val; $expire=-1; $path=$path; $force_current=$force_current
endif

call dump_vars
<!--/parser:xtscript-->    
</div>
<div class="xt_container">
<h1><b>visits={_$$val|}</b></h1><br />
<form action="<xt:url>"  method="post" style="display:inline">
<input type="hidden" name="del" value="1" />
<input class="xt_button" type="submit" value="Delete cookie" />
</form>
<form action="<xt:url>" method="post" style="display:inline">
<input type="hidden" name="del" value="0" />
<input class="xt_button" type="submit" value="Reload page"/>
</form><br />
    </div>
</body>
</html>
