|
|
| Line 33: |
Line 33: |
| * Modify any other variables defined in the constructor (see comment in the code skeleton for their meaning). | | * Modify any other variables defined in the constructor (see comment in the code skeleton for their meaning). |
| Your file descriptor for your module is ready. | | Your file descriptor for your module is ready. |
|
| |
| === Specific descriptor module for version 3.3 ===
| |
| With version 3.3 it will be possible to isolate the "specific" modules in a folder named '''custom'''. The objective of this approach will allow to separate third-party modules from standard modules (those who come from the full release of Dolibarr).
| |
|
| |
| The modules developed for all version of Dolibarr after the 3.2 should be able to be moved in a different folder than "htdocs", like "htdocs/custom", without having to modify the source code of the module .
| |
|
| |
| To make a module compatible with this principle requires that :
| |
| * the pages making up the module must be able to read the file 'main.inc.php' whatever the root folder of the module;
| |
| refer to the contents of the template file '''dev/skeletons/skeleton_page.php'''
| |
|
| |
| ''Example :''
| |
| <source lang="php">
| |
| $res=0;
| |
|
| |
| if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); // for root directory
| |
| if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); // for level1 directory ("custom" directory)
| |
| if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); // for level2 directory
| |
| if (! $res) die("Include of main fails");
| |
| </source>
| |
|
| |
| * 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">
| |
| dol_include_once('/mymodule/class/myclass.class.php', 'MyClass');
| |
| </source>
| |
|
| |
| * The inclusion of classes from dolibarr use the following syntax (module to core or core to core);
| |
| ''Example :''
| |
| <source lang="php">
| |
| if (! class_exists('DoliClass')) {
| |
| require DOL_DOCUMENT_ROOT.'/core/class/doli.class.php';
| |
| }
| |
| </source>
| |
|
| |
|
| * '''conf/conf.php''' file must be modified as follows : | | * '''conf/conf.php''' file must be modified as follows : |