|
Posted by Jochem Maas on 09/26/05 17:36
Mark Rees wrote:
>>>var_dump (realpath('temp'));
>>
>> > I am trying to check whether /lists/admin/temp exists (which it does).
>>
>>This dir doesn't exists. The '/' at the beginning of path means: path is
>>from root (unix) or from e.g. c:\ (windows)
>>
>>Outputs from
>>
>>var_dump(realpath("../../lists/admin/temp"))
>>var_dump(realpath('temp'));
>>
>>are same and thus you working directory is 'C:\...\htdocs\lists\admin'.
>>If you need check existence of dir 'temp' in your current working
>>directory you can try one of:
>>
>>is_dir('temp');
>>is_dir('./temp');
>>is_dir('C:\...\htdocs\lists\admin\temp');
>>
>
>
> I see. I thought this function would work with paths relative to the
> webroot. Thanks for pointing out my mistake.
the biggest msitake seemed to be that you we're writing/posting unix pathes
but you are actually using windows.
>
> Does such a function exist?
not in the engine, but you can write one ... if you need to dynamically
determine the webroot dir from whatever your page you enter ... try playing with this:
realpath( __FILE__ );
and the contents of
$_SERVER['SCRIPT_PATH']
my excuses if that is not the exact SERVER var, if not, look it up or do:
echo '<pre>', var_dump( $_SERVER ), '</pre>';
for instance I cut/paste the following from an application of my,
the code lives in a centrally included file:
/* define a webroot basepath for the datasyncer module */
define('DS_WEBROOT', realpath(dirname(__FILE__).'/..'));
this is only one way of many of how to solve the 'whats my webroot?' problem.
>
> The problem I have is that this path is set in the config section of a 3rd
> party tool I'm using, and called from various pages within the site. I don't
> want to hack the code, as that will make upgrades more difficult to apply.
> Hard-coding the path from c: won't work well either, as that path is
> different in the development and live environments.
if the path is set in the third party tool whats the problem? sorry don't mean to
rude - I really don't quite follow the last part of your post!
>
Navigation:
[Reply to this message]
|