Page 1 of 1

template tutorial: _FILE_ error

Posted: Thu Nov 24, 2011 3:35 am
by salrathor1
Hey guys,

I'm quite new to PHP and I'm trying to work my way through some of the tutorials on here, but i'm having a little problem with the template tutorial.

Jacek talks about using $core_path = dirname(_FILE_); to locate the folder where the current script is stored but when I try to run the code it doesn't return anything. i.e. in the tutorial it says to run die(_FILE_).

I'm assuming there's an error somewhere in my PHP setup? I'm just wondering if someone can help me locate it.

I'm running xampp on MAC OSX if that helps.

Thanks in advance
Sal

Re: template tutorial: _FILE_ error

Posted: Thu Nov 24, 2011 3:42 am
by JelvinJS7
It's two __ underscores on each side.

$core_path = dirname(__FILE__);

//that is correct, the incorrect one is V this one

$core_path = dirname(_FILE_); //what you're doing 


Re: template tutorial: _FILE_ error

Posted: Thu Nov 24, 2011 3:14 pm
by salrathor1
Ahh that probably explains why I failed at the login tutorial sometime back too. Sounds like they added extra underscores just to screw me.

Thanks Jelvin, appreciated.

Re: template tutorial: _FILE_ error

Posted: Fri Nov 25, 2011 10:21 pm
by jacek
This is a problem a lot of people have had, I try to make a point of mentioning that it is two __ now ;)