I have this setting.
root dir|
index.php
config.php
file.php |
|
|scripts|a.js
|
|account
|index.php
| |
|member |index.php
-
Now, I’ve included index.php of member dir into index.php of account dir. Also , the account index.php includes the config.php which contains,
define( 'PATH', (__DIR__) );
Now , for all includes in account index.php I use,
require_once( PATH . '\file.php' );
and is working properly. But when I try to add the path for script src such as,
<script type="text/javascript" src="<?php '.PATH.'scripts/livevalidation.js ?>"></script>
I get an error, so how can i include the a.js in scripts folder into index.php of account using the globally defined path.
Thanks.
The PHP “__DIR__” and “__FILE__” are absolute to the server. You shouldn’t need to use either for your script.
Also, your PHP looks like it has some syntax errors, this would be correct (although still wouldn’t work: