What kind of paths are you talking about? Could you just use $SERVER['DOCUMENT_ROOT'] to get the base path to your public_html directory, and go from there? For example:
define('WWW', $_SERVER['DOCUMENT_ROOT']);
$data = file(WWW . '/datafiles/example.txt');