plainblack.com
Username Password
search
Bookmark and Share

Scratch Variables

Scratch variables are usually used by programmers to store small bits of information about a user or a user’s preferences for the duration of their session in WebGUI. However, scratch variables can also be set via the URL. The later is what this chapter is all about.

Setting

To set a scratch variable, you just add a few fields to the end of the URL in your site. For this example, assume that your site is example.com.

 

http://example.com/?op=setScratch;scratchName=X;scratchValue=Y

 

Let’s take a closer look at the three parameters.

 

op=setScratch

 

This tells WebGUI we want to set a scratch variable.

 

scratchName=X

 

This tells WebGUI we want to set the value of a scratch variable called

 

www_X

 

The value of www_X is then set with the following:

 

scratchValue=Y

 

This tells WebGUI the value of www_X should be Y.

 

Note: Any scratch variable set through the URL will be prefixed with www_. This is done automatically so don't include it with your variable name. It is done this way as a security precaution so that users are not able to maliciously change how a program works without the programmer knowing about it.

 

Deleting

To delete a scratch variable, you just add some fields to the end of your site URL like this:

 

http://example.com/?op=deleteScratch;scratchName=X

 

Let’s take a closer look at the parameters.

 

op=deleteScratch

 

This tells WebGUI we wish to delete a scratch variable.

 

scratchName=X

 

This tells WebGUI that the variable we would like to delete is called

 

www_X

 

Uses

You may want to display something in a scratch variable by creating a custom macro. Or you may want to use these in your own custom assets.

The most popular use, however, is using scratch variables for special inclusion in groups. See Scratch Variables in the Groups chapter for details. In this case, you’re dynamically adding a user to a group for the duration of their session because they have clicked on the link you have provided. This is most commonly used for legal pages where you want the user to agree to something before you give them access to it.

 

Keywords: groups special inclusion

Search | Most Popular | Recent Changes | Wiki Home
© 2018 Plain Black Corporation | All Rights Reserved