Quick links: Content - sections - sub sections
EN FR

jApp is a class bringing informations about the Jelix environment.

It allows to specify (in application.init.php) and to retrieve, different path of the application (Since Jelix 1.3, it replaces JELIX_APP_* constants).

It propose also some methods to retrieve some global Jelix Object and to manipulate Jelix environment (internal use).

Access to some global objects


// the configuration object
$config = jApp::config();

//the router
$coord = jApp::coord();

Retrieve the application directory

The method appPath() returns the full path of the application. In old version, it was JELIX_APP_PATH.



$path = jApp::appPath();

Retrieve the temporary directory

To have the path to the temp directory, call the method tempPath(). In old version, it was JELIX_APP_TEMP_PATH.



$path = jApp::tempPath();

Others methods


// the path to the var/ directory of the application
// equals to the old JELIX_APP_VAR_PATH
$path = jApp::varPath(); 

// the path to the var/log/ directory of the application
// equals to the old JELIX_APP_LOG_PATH
$path = jApp::logPath(); 

// the path to the var/config/ directory of the application
// equals to the old JELIX_APP_CONFIG_PATH
$path = jApp::configPath(); 

// the path to the www/ directory of the application
// equals to the old JELIX_APP_WWW_PATH
$path = jApp::wwwPath(); 

// base path (section urlengine in configuration )
$path = jApp::urlBasePath();

// the path to the main configuration file of the application
// (mainconfig.ini.php or defaultconfig.ini.php for jelix <= 1.5)
$path = jApp::mainConfigFile();

// the path to a module
$path = jApp::getModulePath($nom_module);