Session Variables
   
|Creating Session variables
|Resources
1
2
   
Session Variables
Session variables are items of data that get carried from one page to another on the server. An example is a user's login ID, if you have chosen to generate your site with security of any kind. By default, the login IDs of users that log into your site are carried in session variables. This ensures that your site provides specific users the right level of security, no matter what page or function they are on. You can add session variables of your own to a site. A typical case for such a requirement would be if you needed to carry a user's company ID and need to use it in various pages. In a zeroCode-generated site, session variables can only be the primary keys of tables defined in the schema. If you need a lot of variables that transcend multiple pages, you could define a temporary table in the schema (and the database) and carry its ID everywhere.

We suggest that you minimize the use of such variables, so as to increase the throughput of your site.

One important note: create a given session variable before creating a UDM that would use it. You cannot add a new session variable to an existing site.

   
Steps
1
Click on Edit Session Variable link in the zDE to view the Edit Session Variable screen.
2
You will see six that need to be filled in to create a session variable. The fields are:
  Variable Name - the name of the session variable (normally the name of the primary key).
  Type -  choose a table name from the list shown
 

Default Mode - choose one four values:
            - Input Only - where a given UDM will use this variable only for input
            - Input and Output Only - where a UDM could use it as input or could set its value
            - Output Only - where a UDM would set its value
            - Not Used - where it is not used in a UDM.
Note that this is the default mode that a UDM in your site would use a given variable. This can be overridden in each UDM, as you choose to use it.
    Defining URI - the page where this session variable is created at run time. Note that, if a UDM tries to use this session variable and the variable is not yet defined (because the use has not yet hit the defining URI), the site will automatically take the user to this page.
    Expiry Time - the expiry time for the session variable.
  Transient - a transient session variable is destroyed automatically when a user logs out of your site. A non-transient session variable is written to the user's hard-disk as a cookie.
    Event Listener - a listener program that handles events related to this session variable. You can create on your own custom objects as the listener for a session variable. This listener program is automatically invoked by the site whenever there is a change in the session variable's value.
3
Click on Add to create this new session variable in the generated site's environment. This variable is now available in all future UDMs.
   
 
1
2