|
|
| Line 53: |
Line 53: |
| </source> | | </source> |
|
| |
|
| * the inclusion of classes dedicated to the module is done from the folder containing the php page (module to module);
| | * The inclusion of a class dedicated to the module is done using a Dolibarr function (and not using directly include_once); |
| ''Example :''
| |
| <source lang="php">
| |
| if (! class_exists('MyClass')) {
| |
| require 'class/myclass.php';
| |
| }
| |
| // or if it's in a parent directory
| |
| if (! class_exists('MyClass')) {
| |
| require dirname(__FILE__).'/../class/myclass.php';
| |
| }
| |
| </source>
| |
| | |
| Note: NEVER use a relative path like this: require '../class/myclass.php'; - your include won't work depending on where resides the executed script! Also, your module won't work with both the old main root specification and the new /custom/ specification.
| |
| | |
| * The inclusion of a class dedicated to the module, without knowing from where the file will be called, is done using a function Dolibarr (core to module or module to module); | |
| ''Example :'' | | ''Example :'' |
| <source lang="php"> | | <source lang="php"> |