Re: Full versus relative URLs

From: Date: Wed, 18 Feb 2009 13:54:42 +0000
Subject: Re: Full versus relative URLs
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-288530@lists.php.net to get a copy of this message
Stuart wrote: >>> <?php include dirname(__FILE__)."/../header.php"; ?> This generates a Fatal error: Cal to undefined function dirname() .... ???? I must be really dense... What I don't understand in the above is this - dirname refers to what directory? -- the directory of the file that is including? what if the directory is the root directory of the site? (_FILE_) = what? - (_filename.ext_) or (filename.ext) --- what file is this, the file which is including the file header.php? and what does the . mean and then "/../header.php" --- I don't understand what to enter here >>> Simple as! >>> >>> -Stuart >>> >>> >>> >> Ooooouuuuhhh... I think I just grasped my quandry by the tail... >> I had not thought about it before, but the problem seems to be that my >> header(s) do sometimes include links and/or other includes... so, I >> think there is no simple solution to this. I simply have to make >> different versions of such headers for different (sub)directories. >> Thanks for the clarification. >> > > I said what now? > > By using dirname it doesn't matter where a file is included from so > long as it's never moved to a different relative location to the stuff > it includes. > > But if you've had some sudden enlightenment I wish you luck with it. > > -Stuart > > -- Phil Jourdan --- pj@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com

« previous php.general (#288530) next »