Page 1 of 1
include('$file');
Posted: Wed Jun 27, 2007 11:39 am
by m2babaey
Hi
Can I do this:
$file="articledetails.php";
include('$file');
I really need it or something similar to make my pages more dynamic
Posted: Wed Jun 27, 2007 11:41 am
by Gente
Have you tried?

Posted: Wed Jun 27, 2007 11:47 am
by mentor
You can but use double quotes instead.
Posted: Wed Jun 27, 2007 12:03 pm
by volka
or even better: no quotes at all.
Code: Select all
$file="articledetails.php";
include $file;
"$var" is a wide-spread nonsense.
Posted: Wed Jun 27, 2007 12:49 pm
by mabufo
Posted: Wed Jun 27, 2007 12:56 pm
by Oren
Or just:

Posted: Wed Jun 27, 2007 1:06 pm
by patrikG
or, to cover all the options, you could just choose to not include a file at all!

Posted: Wed Jun 27, 2007 1:45 pm
by RobertGonzalez
include is not a function, it is a language construct. As such, it doesn't require parentheses.
You never have to wrap a variable in quotes unless you are including plain, outputable text with it, and even then you can concatenate instead of parsing.
Try something before you ask if it can be done (really, in this case, how hard would that have been?).