Gallery3:ModuleVar - Gallery Codex
Personal tools

Gallery3:ModuleVar

From Gallery Codex

Variables are stored in the {VARS} table (ex: g3_vars).
Variables could be of any type supported by PHP.
Check [Settings/Advanced] section of Admin dashboard for list of variables currently used by the system.
WARNING: Change these values at your own risk!

Module variables management

$var = module::get_var($module_name, $variable_name, $default_value) - returns stored value for specified variable

Parameters:

  • $module_name - string - Module name variable is belong to
  • $variable_name - string - Name of the variable requested
  • $default_value - var - Optional - Default value if variable is not yet stored. Careful with this, because [Empty] value is still a value.

module::set_var($module_name, $variable_name, $new_value]) - stores a new value for specified variable

Parameters:

  • $module_name - string - Module name variable is belong to
  • $variable_name - string - Name of the variable requested
  • $new_value - var - a New Value associated with specified variable.

module::clear_var($module_name, $variable_name) - removes any references to the variable from VARS table

Parameters:

  • $module_name - string - Module name variable is belong to
  • $variable_name - string - Name of the variable requested

module::incr_var($module_name, $variable_name, $increment) - Increments value of the stored variable by $increment

Parameters:

  • $module_name - string - Module name variable is belong to
  • $variable_name - string - Name of the variable requested
  • $increment - default = 1 - Increment
advertisements