Referencing scripts on different PHP pages

0

I have the following structure:
| - / root
| - / services
| --- / registrations
| - / view
| --- dashboard.php
| --- menu.php | --- / registrations
| ---- / people
| ----- Include_Personal.php
| - / scripts
| - menu.js

Inside the dashboard.php I have the following javascript: $ ("body"). load ("menu.php") which is used to populate a navbar with the options. - Within menu.php I have the file import menu.js

The problem happens when I try to populate the same menu inside "Include_Personal.php" because it is taking the path relative to that file (root / files / people). Even though I use the "../../menu.php" path in the load it tries to look for the menu.js in the directory referring to root / cadastros / personas /.

Would there be a way for me to import these files in an obscure way, without having to leave all the files in the same directory?

    
asked by anonymous 22.06.2018 / 14:35

1 answer

0

If it's a PHP file you could do something like this:

__DIR__ . '../../quantasPastasVocePrecisarVoltar';

DIR     

22.06.2018 / 21:09