PHP File Location Different for Ajax Calls Vs. Inital Load

tereg

New Member
I have a file I use called fileCabinet.php to load in all my classes etc. It works great when my site is loaded from index.php via:\[code\]require_once('../includes/fileCabinet.php');\[/code\]My issue is when I make Ajax calls, I want to use the same classes and would love to use the same file to load them, but the location of the ajax handling script is different from the location of the index.php so I end up with something that looks like this:\[code\]if($admin){ $path = '../';}else if($ajax){ $path = '../../';}@require_once($path . 'admin/includes/generalFunctions.php');@require_once($path . 'admin/corModules/PageAdmin.php');@require_once($path . 'admin/corModules/SEOManager.php');\[/code\]I have two different paths depending on where I'm calling from (admin or ajax). I'm wondering if there is a die-hard approach to locating your files no matter where the call for it comes from. Thoughts?
 
Back
Top