how can i retrieve the filename of the current file and get a result like "index.php" ?????
Printable View
how can i retrieve the filename of the current file and get a result like "index.php" ?????
the ASP equivalent would bebut would return a value something like: "dir/filename.ASP" ; that would do for what i want, anything like that but in PHP please ??Code:<%
Request.Servervariables("path_info")
%>
any help appreciated greatly.
:)
_Ubunr3al_
PHP Code:print $PHP_SELF;
thanx chrisjk, i'll give it a try. u wouldnt happen top know how to do include scripts in php woud ya ?
yep, you can include other php scripts like this
that could include functions and whatnot.PHP Code:require('./other.php3');
As a side note, use require if it must work, e.g. the file must exist, otherwise use include. If you use include (same syntax) then the script will continue even if there are problems
ok, so they work exacly the same except one displays errors if there is any ?
that is correct
uhhhhh no, they don't have anything to do with errors.Quote:
Originally posted by ubunreal69
ok, so they work exacly the same except one displays errors if there is any ?
Quote:
include() differs from require() in that the include statement is re-evaluated each time it is encountered (and only when it is being executed), whereas the require() statement is replaced by the required file when it is first encountered, whether the contents of the file will be evaluated or not (for example, if it is inside an if statement whose condition evaluated to false).
don't be so hasty scoutt...
Quote:
from php.net
The two constructs are identical in every way except how they handle failure....use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless.
lol :D this could get funny ;)Quote:
Originally posted by chrisjk
don't be so hasty scoutt...
well was that in the manual? maybe I didn't read down far enough. but I could swear that when I include it does stop on errors. but my fading brain my say different. I go tmy quote from the manual, but like I said I must not have read far enough.
it's not like we're ganna have a bust up over it!Quote:
Originally posted by ubunreal69
lol :D this could get funny ;)
It's near the top of the Include function docs, but you are right in that require also is imported even if it's not needed (like in false If's), but they also differ regarding error handling apparently :)
Hmm, well, since the beginning of this thread i have been using INCLUDE without having to debug anything cos i dont generally make errors with those sort of things. although looping through database results is another story altogether :D
BTW. chrisjk, I knew this wouldnt have turned into a big fight, but i find watching peeople sort out differences to be interesting. i actually enjoy arguing with people ;)
don't generally make errors? liek you are perfect or you don't code anyhting that is hard :pQuote:
Originally posted by ubunreal69
Hmm, well, since the beginning of this thread i have been using INCLUDE without having to debug anything cos i dont generally make errors with those sort of things. although looping through database results is another story altogether :D
BTW. chrisjk, I knew this wouldnt have turned into a big fight, but i find watching peeople sort out differences to be interesting. i actually enjoy arguing with people ;)
and most adults know how to handle things so there is no fighting, unlike most kids on this forum (mostly from the past) that think they are right all the time. I'd admit if I was wrong and chris usually knows what he is talking about so he wouldn't lie to me ;)
he he, not always ;)Quote:
Originally posted by scoutt
chris usually knows what he is talking about
I think the main idea of include/require is indeed what you said and what I said is probably just a side-issue
yeh, if you count GR12 as being full of "Kids"; i'm not as immiture as you'd think ! :( :rolleyes:Quote:
Originally posted by scoutt
don't generally make errors? liek you are perfect or you don't code anyhting that is hard :p
and most adults know how to handle things so there is no fighting, unlike most kids on this forum (mostly from the past) that think they are right all the time. I'd admit if I was wrong and chris usually knows what he is talking about so he wouldn't lie to me ;)