Liste des variables globales pour les modules

Un article de OviWiki.


Variables globales pour les modules et l'OVML

$BAB_SESS_LOGGED if set and true, the current user is a registered user and is logged in. Otherwise he is an anonymous visitor.
$BAB_SESS_USER contains the full name of the current user. If empty, the user is an anonymous visitor.
$BAB_SESS_NICKNAME contains the nickname of the current user. If empty, the user is an anonymous visitor.
$BAB_SESS_USERID contains the id of the current user. If empty, the user is an anonymous visitor.
$babCurrentDate today date in timestamp format.
$babInstallPath contains the path where the Ovidentia PHP files are installed. This path is relative to the site document root folder that contains the config.php script file.The path is terminated by a slash.
$babSkin contains the name of the currently used skin.
$babSkinPath $babInstallPath."skins/".$babSkin."/"
$babCssPath “skins/".$babSkin."/styles/name of file choosen by user.css".
$babScriptPath $babInstallPath."scripts/"
$babLanguage holds a string initialized to the current language for the user interface ( en, fr, nl, nl-be, ... ). You can use this variable to translate text making the language compatible with the rest of the user interface. Ovidentia type language files lang-en.xml and others must be completed for your add-on.
$babStyle current CSS file used ( with .css extension ).
$babSiteName contains the site name.
$babUrl URL to access the current site (http://www.example.com/). This is your site document root where config.php and index.php reside.
$babAdminEmail Email de l'administrateur
$babAdminName Nom de l'administrateur

Variables globales du contexte d'un module

$babAddonUrl gives the full URL, including the end slash, to your add-on program folder.
$babAddonPhpPath contains the path to your add-on program folder.
$babAddonTarget contains "addon/x" where x is the id of your add-on in the Ovidentia database.
$babAddonHtmlPath contains the path to your add-on template folder.
$babAddonFolder this variable contains the folder name of your add-on. This is also your add-on name.
$babAddonUpload this is the folder name where your add-on can store documents or files. This folder is a sub-directory of $babUploadPath folder.


The different $babAddon variables are here to help us to write an add-on. Let's illustrate their content with an example. Imagine an add-on with the name "my-add-on" that is identified in the Ovidentia database as the add-on with id = 2. And that our site has a $babUrl = "http://www.example.com/". Then we will have the following values for the $babAddon variables:

$babAddonUrl = "http://www.example.com/index.php?tg=addon/2/"
$babAddonPhpPath = "ovidentia/addons/my-add-on/"
$babAddonTarget = "addon/2"

By using this variable you don't have to worry about add-on's id numbers.

$babAddonHtmlPath = "addons/my-add-on/"
$babAddonFolder = "my-add-on"
$babAddonUpload = $babUploadPath. "/addons/my-add-on/"