Tips

The following is a collection of tips and tricks for coding that elucidate some of the darker corners of WIKINDX programming.

Browser state variables and their storage

For conserving the browser state variables, WIKINDX can use either standard server sessions or its own storage mechanism designated browserTabID. In most cases, standard server session are fine with the state variables being common to all browser windows and tabs.

But, in some cases, it can be useful to open multiple browser windows or tabs in order to view, for example, different lists of resources. In such cases, many state variables must be unique to each window or tab. In WIKINDX, this is accomplished using the browserTabID, and this storage mechanism must be enabled by the WIKINDX administrator in the Admin > Configure > Miscellaneous interface. A unique ID is generated for each window or tab and is used as the row identifier in the temp_storage database table. Rows in this table are deleted automatically if their timestamps are older than three days. This ID can be accessed in your code using:
$browserTabID = GLOBALS::getBrowserTabID()

and should be passed in a querystring as:
'&browserTabID=' . $browserTabID;

If you are using a form in your code, the variable ‘browserTabID’ is automatically added as a hidden form element.

You should generally access the browser state variables with the routines in the STORE library:
$store = FACTORY_STORE::getInstance();

This library handles either standard server sessions or browserTabID variables transparently depending on the WIKINDX configuration.

Note that some browser state variables must be accessed with the routines in the SESSION library:
$session = FACTORY_SESSION::getInstance();

as they are common to all browser windows and tabs. These variables include:

  • setup_UserId
  • setup_Superadmin
  • setup_Write
  • setup_ReadOnly
  • setup_Language
  • setup_Bibliographies
  • setup_Template
  • setup_Style
  • fileExports
  • menu_menu
  • menu_state