Andy -- ...and then Ns_Andy said... % % what's its use and how to use(Example)?
They're constants that identify where you are. I use __FILE__ so that I don't have to keep tweaking my code when working in the development environment: # this will let us figure out where we are and then always source the right include stuff! # it does not work with symlinks (__FILE__ reports the *target*) # you must have a full env tree in your devel tree; we now look exclusively in $DEVELDIR if set if ( ereg("/home/sites/\.php/",__FILE__) ) # are we *somewhere* in our usual master tree? { $DEVELDIR = preg_replace("|/.*/home/sites/\.php(.*)/[^/]*$|","$1",__FILE__) ; } # get the working dir include("/home/sites/.php$DEVELDIR/includestuff.inc"); # include our various files Our repository is under /home/sites/.php and there are various production, development, and test dirs under there. No more hard-coding /home/sites/.php/test6/includestuff.inc in the code -- and, worse, forgetting to take it out when promoting to production! :-) [Yeah, I know that I should assign a variable containing the "/home/sites/\.php/" string, but it's almost not worth it in something that has to be self-contained like this and so I haven't bothered :-] % % Thanks HTH & HAND % -- % Regards, :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg82262/pgp00000.pgp
Description: PGP signature