I need to add my “web app” to an existing site. It will be placed in a separate folder.
What is the best way to define the root for my app? It will have no interaction with the rest of the site.
I thought of just creating a .php script in my root and do something like:
define('ROOT_DIR', dirname(__FILE__));
And then include this file in all other scripts.
Is this the right way to do it?
FROM PHP DOC on
dirname(__FILE__)or__DIR__This can easily change depending on our be structure and one single config file
eg.
My Advice .. HARD CODE it since it is always fixed
if you have a file in
/public_html/class/HelloWord.class.phpYou can easy access it has the following no matter your current directory