Page 1 of 1
how to know what files were required/include?
Posted: Sat Jul 19, 2003 12:27 pm
by Cruzado_Mainfrm
i don't have any coding yet, but my question is, how can i know what files were required/included in a php page by using include or require?
Posted: Sat Jul 19, 2003 12:52 pm
by steedvlx
Hi,
If I understand your question (which, admittedly is not a certainty) You are looking for the file names that were included/required to create an output page that I guess you are looking at.
One of the many beauties of PHP is that this is impossible unless you have access to the web-server's root and can get to the pre-server source code for that page. [In that case, what you are looking for is before the <HEAD> tag in the source code.]
All of the include and require directives are pre-processed by the server and there is no client-side output associated with the directives themselves although the included/required code itself does create HTML output.
PHP...Gotta love it.
Sorry if I didn't understand your question properly.
-----------------------
SteedVLX
Posted: Sat Jul 19, 2003 3:28 pm
by Cruzado_Mainfrm
i understood that php won't let you know because of possible security problems.. right? then i guess i will have to do something like this:
Code: Select all
<?php
$is_page_one_loaded = (@include 'mypage.php') ? true: false;
?>
is that right?
Posted: Sat Jul 19, 2003 9:46 pm
by steedvlx
That is a little out of my ballpark. Sorry.
But, IMHO if you have the session variable ($is_page_one_loaded) registered, and you set its value to true within the included script, then it will work just fine.
I Think I'll try it myself when I get a chance.
Anybody else?
---------------------------
SteedVLX
Posted: Sat Jul 19, 2003 10:31 pm
by Stoker
if your goal is to make sure something is loaded you can use
include_once() and require_once()
But, if you need this it sort of proves that the programming methods/layout etc is not very good, the structure and such should be in a controlled way.. Very understandable if you are hacking a couple of different scripts/programs together or similar.