|
-
Feb 17th, 2002, 03:56 AM
#1
Thread Starter
Fanatic Member
retrieve filename
how can i retrieve the filename of the current file and get a result like "index.php" ?????
-
Feb 17th, 2002, 03:59 AM
#2
Thread Starter
Fanatic Member
the ASP equivalent would be
Code:
<%
Request.Servervariables("path_info")
%>
but would return a value something like: "dir/filename.ASP" ; that would do for what i want, anything like that but in PHP please ??
any help appreciated greatly.
_Ubunr3al_
-
Feb 17th, 2002, 11:09 AM
#3
PowerPoster
PHP Code:
print $PHP_SELF;
-
Feb 17th, 2002, 06:07 PM
#4
Thread Starter
Fanatic Member
thanx chrisjk, i'll give it a try. u wouldnt happen top know how to do include scripts in php woud ya ?
-
Feb 17th, 2002, 08:39 PM
#5
PowerPoster
yep, you can include other php scripts like this
PHP Code:
require('./other.php3');
that could include functions and whatnot.
-
Feb 17th, 2002, 08:45 PM
#6
PowerPoster
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
-
Feb 18th, 2002, 06:41 PM
#7
Thread Starter
Fanatic Member
ok, so they work exacly the same except one displays errors if there is any ?
-
Feb 18th, 2002, 08:48 PM
#8
PowerPoster
-
Feb 25th, 2002, 03:52 PM
#9
Originally posted by ubunreal69
ok, so they work exacly the same except one displays errors if there is any ?
uhhhhh no, they don't have anything to do with errors.
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).
-
Feb 25th, 2002, 04:44 PM
#10
PowerPoster
don't be so hasty scoutt...
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.
Last edited by chrisjk; Feb 25th, 2002 at 04:47 PM.
-
Feb 25th, 2002, 07:18 PM
#11
Thread Starter
Fanatic Member
Originally posted by chrisjk
don't be so hasty scoutt...
lol this could get funny
-
Feb 25th, 2002, 10:33 PM
#12
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.
-
Feb 26th, 2002, 10:58 AM
#13
PowerPoster
-
Feb 27th, 2002, 06:09 AM
#14
Thread Starter
Fanatic Member
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 
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
-
Feb 27th, 2002, 10:22 AM
#15
-
Feb 27th, 2002, 11:23 AM
#16
PowerPoster
Originally posted by scoutt
chris usually knows what he is talking about
he he, not always 
I think the main idea of include/require is indeed what you said and what I said is probably just a side-issue
-
Feb 27th, 2002, 06:11 PM
#17
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|