About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
legacy:vufind_1.x_developer_manual:global_variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
legacy:vufind_1.x_developer_manual:global_variables [2015/12/10 18:21] – ↷ Page moved from global_variables to legacy:vufind_1.x_developer_manual:global_variables demiankatzlegacy:vufind_1.x_developer_manual:global_variables [2018/12/19 14:20] (current) demiankatz
Line 1: Line 1:
 ====== Global Variables ====== ====== Global Variables ======
  
-:!: // This page refers to VuFind 1.x; newer versions of VuFind do not rely on global variables at all// +// As of release 2.0, VuFind no longer relies on global variables. This outdated page has been deleted to prevent confusionTo view old content for historical interestsee the "Old Revisions" list below. //
- +
-VuFind uses a few important global variables that you may find helpful when [[legacy:vufind_1.x_developer_manual:building_a_module|building modules]] and maintaining the code. +
- +
-===== Primary Globals ===== +
- +
-These two globals are the most important, and their use is encouraged: +
- +
-  * $configArray \\ This global contains the contents of the web/conf/config.ini file mapped into associative array format. +
-  * $interface \\ This global is an instance of the UInterface class, used for passing information to the Smarty presentation layer See the [[legacy:vufind_1.x_developer_manual:system_classes|System Classes]] page for more details. +
- +
-===== Secondary Globals ===== +
- +
-These globals are used in the code in a few placesbut their use should be avoided unless absolutely necessary: +
- +
-  * $translator \\ This global is an instance of the I18N_Translator class, used for translating presentation-layer text into various languages This should be needed only rarely outside of the presentation templates. +
-  * $user \\ This global is an object representing the current logged-in user, if one exists.  User login code may be refactored, so use this sparingly. +
- +
-===== Accessing a Global ===== +
- +
-Remember that in PHP, you need to declare globals at the top of any functions or methods that use them.  For example: +
- +
-<code php> +
-function dumpConfigArray()  +
-+
-    global $configArray; +
- +
-    print_r($configArray); +
-+
-</code>+
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
legacy/vufind_1.x_developer_manual/global_variables.txt · Last modified: 2018/12/19 14:20 by demiankatz