September 11th, 2000, 08:55 PM
I write a script news.php calls a function head() in predefine.php,which include a head.html file.
the problem is when I call function head(),I always get include path error,I found out that $DOCUMENT_ROOT is NULL,but I use phpinfo() got the correct value.
Can somebody tell me why?
I use PHP4.0.1pl2 on RedHad 6.1 with apache 1.3.12 static .
sorry for my poor english
September 12th, 2000, 12:01 AM
Can you explain the layout of the files a little more? This is how I interpret your question...
If you're calling it just like that and everything is in the same directory, then it should work. I can't see a problem. $DOCUMENT_ROOT is goign to be null within the head() function because it's a function. You'd have to declare the variable as global, or pass it along if you want to use it in a function.
Maybe you can explain a little more if you are still having trouble.
September 12th, 2000, 05:29 AM
Yes , it is.
thanks,I got it.
I am amazed that phpinfo() in head() got the correct value.
I can go round it by assign another variable before I call head().