atholon Posted October 16, 2007 Share Posted October 16, 2007 I have two questions... first.. is there a way to get the name of the script cureently running inside of the script? For example...I am using test.php is there a way in the coding that I can have the script auto detect the name of the file? The other question is... I tried defining a variable $thispage and I set it to the value at the top of the PHP file...I am using many functions in the file that will use that variable...do I have to pass the variable in all of the function heads referring to the () part of the function? I am getting a Notice: Undefined variable: pagename in d:\easyphp\www\video.php on line 224 Error. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/ Share on other sites More sharing options...
pocobueno1388 Posted October 16, 2007 Share Posted October 16, 2007 is there a way in the coding that I can have the script auto detect the name of the file? $_SERVER['PHP_SELF'] Will return the files name. Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/#findComment-371162 Share on other sites More sharing options...
pocobueno1388 Posted October 16, 2007 Share Posted October 16, 2007 And for your second question, yes...you will have to pass the variable as a parameter of the function. Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/#findComment-371164 Share on other sites More sharing options...
corillo181 Posted October 16, 2007 Share Posted October 16, 2007 the one he gave you will give you the entire path to where the script is this one will give you just the name of your script page $_SERVER['SCRIPT_NAME'] Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/#findComment-371165 Share on other sites More sharing options...
pocobueno1388 Posted October 17, 2007 Share Posted October 17, 2007 the one he gave you will give you the entire path to where the script is this one will give you just the name of your script page $_SERVER['SCRIPT_NAME'] No it won't, it will give you the name of the script along with it's extension. Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/#findComment-371173 Share on other sites More sharing options...
corillo181 Posted October 17, 2007 Share Posted October 17, 2007 php self contain the script extension also. Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/#findComment-371177 Share on other sites More sharing options...
atholon Posted October 17, 2007 Author Share Posted October 17, 2007 Hehe SWEET You guys are the BOMB! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/73565-solved-page-name/#findComment-371178 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.