When I want to include a php file only conditionally, I use include instead of require. At the moment I am trying to solve the following problem. I haven't found anything in the news archive, perhaps I searched with the wrong phrase...
----code snippet----- <?php $includefiles=1;
if(...) { ... //some nested if statements. ... //in some cases $includefiles is set to 0 }
if($includefiles==1) { include('incfile.php'); } ?> ----end code-----
In this code, the include file is always parsed, even if $includefiles is set to 0. Even the files which are 'required()' inside incfile.php are parsed (observed with the program Filemon, which registers file access). I tried various ways to nest the if statements, but none helped. Any suggestions to have incfile.php parsed only if needed?
I am using PHP Version 4.3.4 as Module, Apache/2.0.48, on Windows 2000.
Thanks a lot for any suggestions! Andreas
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php