Page 1 of 1

Splitting material.inc

Posted: 29 June 2020, 16:08
by Lunalol
Hi. Is there a way to split "material.inc" using require_once ?

require_once("module/something.php") doesn't work, bad path.
require_once("something.php") doesn't work, bad path.

Inclusion works in js with : g_gamethemeurl + "modules/something.js
Inclusion works in php but only in mygame.game.php not in material.inc

Thansk a lot.

Re: Splitting material.inc

Posted: 29 June 2020, 18:13
by Draasill
I didn't try, but maybe you can use __DIR__ ?

Code: Select all

require_once __DIR__ . "/foobar.php";

Re: Splitting material.inc

Posted: 29 June 2020, 19:51
by Brainchild
Lunalol wrote: 29 June 2020, 16:08 Hi. Is there a way to split "material.inc" using require_once ?

require_once("module/something.php") doesn't work, bad path.
The directory name is modules (with an 's'), maybe you just spelled it wrong?

Re: Splitting material.inc

Posted: 29 June 2020, 20:32
by Tisaac
Brainchild is right, you just have to put in the right name.
I am using require_once a lot in the Santorini adaptation and it works just fine in the material.inc file.

Re: Splitting material.inc

Posted: 29 June 2020, 20:40
by Lunalol
SOLVED !
The problem was not the 's' (I dont forget it), it was the ONCE, require is ok, require_onde doesn't work (game start but data are losing after).