Module development: Difference between revisions

Jump to navigation Jump to search
Tag: 2017 source edit
Tag: 2017 source edit
Line 242: Line 242:
if (! $res) die("Include of main fails");
if (! $res) die("Include of main fails");
</source>
</source>
As you can see, there is several tries to load the main.inc.php (or master.inc.php). The goal is to succeed in the most cases as possible. The minimum is 2 lines: one to try to load the master/main.inc.php into the dolibarr root directory and another one to try to load the file to support the case when the module is deployed into the "custom" directory. But you can have more to deal more situation. The provided example should be able to load the file main/master.inc.php in nearly all situation/setups.
As you can see, there are several tries to load the main.inc.php (or master.inc.php). The goal is to succeed in the most cases as possible. The minimum is 2 lines: one to try to load the master/main.inc.php into the dolibarr root directory and another one to try to load the file to support the case when the module is deployed into the "custom" directory. But you can have more to deal more situation. The provided example should be able to load the file main/master.inc.php in nearly all situation/setups.


Note that you may add more "../" depending on the depth of the file relative to your module directory tree.
Note that you may add more "../" depending on the depth of the file relative to your module directory tree.
6

edits

Navigation menu