PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I get this error any time I'm trying to use the constant $DOCUMENT_ROOT in an include statment as part of my class. Can any one give me some insight it could be something PHP just wont do...
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in class.php on line 22
Shouldn't you be using $_SERVER['DOCUMENT_ROOT']? I'm not sure myself but those PHP vars (like $PHP_SELF) I have heard can cause problems. I personally do not use them.
Everah wrote:Shouldn't you be using $_SERVER['DOCUMENT_ROOT']? I'm not sure myself but those PHP vars (like $PHP_SELF) I have heard can cause problems. I personally do not use them.
As long as register globals is on the constant $DOCUMENT_ROOT is available to you. (This is an intranet project so extreme security is not as much of a concern.)
echo $DOCUMENT_ROOT . '/template/header.php'; // check to make sure it outputs the correct path.
echo getcwd(); // see where you currently are, and investigate the possibility of using relative paths...