dbs2008uk Posted April 28, 2008 Share Posted April 28, 2008 Hi, I just came accross a situation where I wanted to use the same file twice, once by calling it by name i.e. http://some.com/update.php and the second instance as an include. include'update.php'; I wanted update.php to behave diferently depending on whether or not is is included? I ended up doing this: // in dosearch.php $search=1; include'update.php'; // in update php, I check for $search and if its not there and so on...... if(!$search) { $autolayout = 1; require_once'../../codebase/update.inc.php'; } This works great though Im still curious!! Im wondering a couple of things,: Is there a simple way to see if a .php file is included? i.e. if(included()) { } or now while writing this Im thinking I should have just made one file with the array in then included this when I need it? So really can I query included() or what would be best practice for this situation? Thanks for your advice in advance. Regards Richard Link to comment https://forums.phpfreaks.com/topic/103252-ifincludedblahphp-else/ Share on other sites More sharing options...
Rohan Shenoy Posted April 28, 2008 Share Posted April 28, 2008 What I am suggesting is a just a variation of what you are already doing. I use DEFINE() instead of variables. Link to comment https://forums.phpfreaks.com/topic/103252-ifincludedblahphp-else/#findComment-528839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.