include function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
WebMonkey
Forum Newbie
Posts: 19
Joined: Tue May 11, 2004 1:43 pm

include function

Post 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
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

write:

Code: Select all

include ('standardheader.php');
and you have a happy day again.
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post 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?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

launchcode wrote:include will work with our without the braces,
well thats news to me
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post 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.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

launchcode wrote:Learn something new every day?
lol, too true
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

and what a boring life we would lead if we didn't :)
Post Reply