Brimbox Logo Brimbox Version 2.3.4 Released

Reserved Variables and Naming Conventions>>

Brimbox is set up for easy naming of variables and functions. The modular structure of Brimbox and the posting algorithm make it so you can name any variable, form variable or function in your custom modules (or PHP script) anything. However, there are some areas in Brimbox that need careful nomenclature at either the instance or interface level.

The module and file name must be unique. We recommend you pick a prefix of your initials, or your company name, or another prefix prepended before your descriptive filename (abc_filename.php) and corresponding module name (abc_filename). Brimbox will not install a module if there is already a module with the same module and file name (even if it is in a different directory) so the program should weed out any module name conflicts during installation. Brimbox uses the module name in a required form variable to keep track of its state and during form posts.

Brimbox standard functions, aside form string and translation functions, are all grouped under the class $main. If your function is local to your module you can name it most anything except $main. Brimbox uses a controller running one module at a time so different modules actually could have different functions with the same name:

Naming Conventions

There are some global variables passed in to the modules from the controller which should be avoided and not changed when writing modules. Some of these variables are commonly used in the modules, and also, some are set from session variables. They are:

  1. $POST (the Brimbox $POST variable, the equivalent of $_POST)
  2. $GET (reserved for later use)
  3. $userroles (available permissions of the user as a comma separated string, like "1_bb_brimbox,4_bb_brimbox")
  4. $userrole (the active permission level of the user, like "4_bb_brimbox." The userrole is an integer and underscore prepended to the interface name)
  5. $interface (the current interface for the user, like "bb_brimbox", derived from the userrole)
  6. $username (the login of the current user)
  7. $email (the email of the current user)
  8. $con (the database connection variable)
  9. $module (the target module name when posting, the filename without the .php extension)
  10. $submit (the previous module name when posting, $submit and $module are the same for postback)
  11. $button (the integer value indicating what button was chosen, 0 is the default)
  12. $archive (the current archive state, an integer)
  13. $keeper (the id field of the database table state_table used to store the state)
  14. $timeout (reserved for future use to regulate $_SESSION)
  15. $abspath (the linux abspath directory of the index.php file)
  16. $webpath (the web path from the current domain to the index.php file)
  17. $slug (the slug of the current module, either the module name or derived from it)
  18. $path (the relative path of the current module used to include the module, this is passed in from the interface rending codeblock (by default box.php), not the index.php controller.)
  19. $main (the Brimbox $main object, all the Brimbox standard functions are collected in this object)

There is also the global array ($array_global) which is used to define action hooks and other variables in Brimbox.

The global array is parsed into arrays based on the name ($name above like “links”, “hooks”, “userroles” etc), These are the default arrays $array_global is parsed into:

These are native to all interfaces:
$array_header
$array_userroles
$array_security
$array_validation
$array_interface
$array_reports

These are native to the bb_brimbox (or standard) interface:
$array_hooks
$array_common_variables
$array_links

The hot state array is brought into the controller through a hook to a pluggable function:
$array_hot_state

It is recommended that module and custom array variables use the prefix $arr_ not $array_ to prevent conflicts and to differentiate from the global array.

Updated: 2017-07-30

Documents

Definitions