31,034
edits
| Line 46: | Line 46: | ||
= Usage in coding = | = Usage in coding = | ||
Content of file must be used by developers by using predefined constants or the object '''$conf''' created by the script '''master.inc.php''' that must be | Content of file must be used by developers by using predefined constants or the object '''$conf''' created by the script '''master.inc.php''' that must be includes at beginning of every PHP program (scripts or pages). | ||
Your code must never open the config file and read it directly. This is not necessarly. | |||
* $dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT | * $dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT | ||
* $dolibarr_main_url_root is known in code in constant: DOL_URL_ROOT | * $dolibarr_main_url_root is known in code in constant: DOL_URL_ROOT | ||
| Line 58: | Line 58: | ||
* $dolibarr_main_db_pass is not known by code. It is read by script '''master.inc.php''' (to be called by every PHP pages) that created on object connexion '''$db''' then variable $dolibarr_main_db_pass is erased. | * $dolibarr_main_db_pass is not known by code. It is read by script '''master.inc.php''' (to be called by every PHP pages) that created on object connexion '''$db''' then variable $dolibarr_main_db_pass is erased. | ||
However, your development should never have to use this variables but only should use instead following global variable or constants: | |||
* DOL_DOCUMENT_ROOT (that indicate physical path of directory where permanent or temporary files are stored) | |||
* DOL_URL_ROOT (that indicate relative URL that is Dolibarr root). | |||
* $db | |||
* $conf | |||
* $user | |||
* $langs | |||
See tutorial on page [[Module development|Module development]] or [[Script development]] for more information. | See tutorial on page [[Module development|Module development]] or [[Script development]] for more information. | ||