Page 1 of 1

include function

Posted: Wed May 12, 2004 5:26 am
by WebMonkey
Why am i feeling ignored by my php server well it all started on the happy day i wrote the line

include 'standardheader.php';

and when parsed Boom nothing although i actually have a file called standardheader.php with losts of lovely code in it

any ideas? i know its probably a simple one

Posted: Wed May 12, 2004 5:41 am
by patrikG
write:

Code: Select all

include ('standardheader.php');
and you have a happy day again.

Posted: Wed May 12, 2004 8:35 am
by launchcode
include will work with our without the braces, the problem is far more likely it cannot find this file - is the script that is trying to include standardheard in the same directory location?

Posted: Wed May 12, 2004 8:36 am
by malcolmboston
launchcode wrote:include will work with our without the braces,
well thats news to me

Posted: Wed May 12, 2004 8:40 am
by launchcode
Learn something new every day? It's true though - even the PHP manual doesn't use braces in the include function examples. Infact it's down to personal preference really, you don't NEED them, but to keep things consistent with other PHP functions lots of people like to use them.

Posted: Wed May 12, 2004 8:43 am
by CoderGoblin
You may also find you have a PHP syntax error within the included file.

On linux I run a php -f <filename> which tells me a line number which causes the error. This is more useful than the empty page.

Posted: Wed May 12, 2004 9:36 am
by malcolmboston
launchcode wrote:Learn something new every day?
lol, too true

Posted: Wed May 12, 2004 9:50 am
by launchcode
and what a boring life we would lead if we didn't :)