If you have trouble understanding this or require more information, add a comment

Within my functions.php, I create a link to refer to my index file. Since this function is called by all my main .php files, the path to the index file varies dependent on the page calling the function.

For example, if the function is called by my index file, the path would obviously be "index.php". However if the function is called from my viewaccount.php file, the required path would be "../../index.php"

Therefore my problem is:

How can I set a general path, which independent from which file I call my function, it will always link correctly to my index file.

Once quick fix is to put all my main php files as siblings to my index, but I want to keep all my files organised

@user1724140 define this in a bootstrap file that you include in the entry point of your application, or just in the first line of code in your entry point. Then this constant will be available form all your code.
–
slash28cuNov 8 '12 at 19:59