Hi, I am using dirname($_SERVER['SCRIPT_FILENAME']); and including the file in other files. the way it is now, it gets the directory of the file that is calling the include. I want it to use the directory of the file that is being included. How do I do this? Thanks
It looks like you want the PHP __FILE__ "magic" constant. dirname(__FILE__) should then give you the directory of the file that has been included. More information on __FILE__ and other "magic" constants: http://www.php.net/manual/en/language.constants.predefined.php
It would seem to work in the situation you described, and provide you with the desired results. Is there any specific reason you'd prefer not to use the __FILE__ constant?
I changed from $_SERVER[SCRIPT_FILENAME] to http:// . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']} So __FILE__ Does not achieve the correct results.