Could any one tell me how to use the $include_file function within an IF?
Eg,
If $BLAH BLAH {
i want to include a file here
} else {
Want to iclude another file here
}
Thanks.
you kinda answered your own question:
if ($blah == 1) { include(file_1); } else { include(file_0); }
if (condition == true) { include(\'fileA\'); } else { include(\'fileB\'); }
Al & Xris answered the question, but thought I'd pipe in to remind you that conditional includes can lead very quickly to unmaintainable and cryptic code..... use them sparingly (and carefully🙂.
geoff
hi,
the earlier messages did provide a feasible solution but, if you wish to include a Non-PHP based file it would be better to use readfile() function..since
regs, sgb.